regsuart.h 156 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848
  1. /*
  2. * Copyright (c) 2012, 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. * i.MX6UL UART
  26. *
  27. * UARTv2
  28. *
  29. * Registers defined in this header file:
  30. * - HW_UART_URXD - UART Receiver Register
  31. * - HW_UART_UTXD - UART Transmitter Register
  32. * - HW_UART_UCR1 - UART Control Register 1
  33. * - HW_UART_UCR2 - UART Control Register 2
  34. * - HW_UART_UCR3 - UART Control Register 3
  35. * - HW_UART_UCR4 - UART Control Register 4
  36. * - HW_UART_UFCR - UART FIFO Control Register
  37. * - HW_UART_USR1 - UART Status Register 1
  38. * - HW_UART_USR2 - UART Status Register 2
  39. * - HW_UART_UESC - UART Escape Character Register
  40. * - HW_UART_UTIM - UART Escape Timer Register
  41. * - HW_UART_UBIR - UART BRM Incremental Register
  42. * - HW_UART_UBMR - UART BRM Modulator Register
  43. * - HW_UART_UBRC - UART Baud Rate Count Register
  44. * - HW_UART_ONEMS - UART One Millisecond Register
  45. * - HW_UART_UTS - UART Test Register
  46. * - HW_UART_UMCR - UART RS-485 Mode Control Register
  47. *
  48. * - hw_uart_t - Struct containing all module registers.
  49. */
  50. //! @name Module base addresses
  51. //@{
  52. #ifndef REGS_UART_BASE
  53. #define HW_UART_INSTANCE_COUNT (8) //!< Number of instances of the UART module.
  54. #define HW_UART1 (1) //!< Instance number for UART1.
  55. #define HW_UART2 (2) //!< Instance number for UART2.
  56. #define HW_UART3 (3) //!< Instance number for UART3.
  57. #define HW_UART4 (4) //!< Instance number for UART4.
  58. #define HW_UART5 (5) /*!< Instance number for UART5. */
  59. #define HW_UART6 (6) /*!< Instance number for UART6. */
  60. #define HW_UART7 (7) /*!< Instance number for UART7. */
  61. #define HW_UART8 (8) /*!< Instance number for UART8. */
  62. #define REGS_UART1_BASE (0x02020000) //!< Base address for UART instance number 1.
  63. #define REGS_UART2_BASE (0x021e8000) //!< Base address for UART instance number 2.
  64. #define REGS_UART3_BASE (0x021ec000) //!< Base address for UART instance number 3.
  65. #define REGS_UART4_BASE (0x021f0000) //!< Base address for UART instance number 4.
  66. #define REGS_UART5_BASE (0x021f4000) //!< Base address for UART instance number 5.
  67. #define REGS_UART6_BASE (0x21FC000U) //!< Base address for UART instance number 6.
  68. #define REGS_UART7_BASE (0x2018000U) //!< Base address for UART instance number 7.
  69. #define REGS_UART8_BASE (0x2024000U) //!< Base address for UART instance number 8.
  70. //! @brief Get the base address of UART by instance number.
  71. //! @param x UART instance number, from 1 through 5.
  72. #define REGS_UART_BASE(x) ( (x) == HW_UART1 ? REGS_UART1_BASE : (x) == HW_UART2 ? REGS_UART2_BASE : (x) == HW_UART3 ? REGS_UART3_BASE : (x) == HW_UART4 ? REGS_UART4_BASE : (x) == HW_UART5 ? REGS_UART5_BASE : (x) == HW_UART6 ? REGS_UART6_BASE : (x) == HW_UART7 ? REGS_UART7_BASE : REGS_UART8_BASE)
  73. //! @brief Get the instance number given a base address.
  74. //! @param b Base address for an instance of UART.
  75. #define REGS_UART_INSTANCE(b) ( (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 : (b) == REGS_UART6_BASE ? HW_UART6 : (b) == REGS_UART7_BASE ? HW_UART7 : (b) == REGS_UART8_BASE ? HW_UART8 : 0)
  76. #endif
  77. //@}
  78. //-------------------------------------------------------------------------------------------
  79. // HW_UART_URXD - UART Receiver Register
  80. //-------------------------------------------------------------------------------------------
  81. #ifndef __LANGUAGE_ASM__
  82. /*!
  83. * @brief HW_UART_URXD - UART Receiver Register (RO)
  84. *
  85. * Reset value: 0x00000000
  86. *
  87. * The UART will yield a transfer error on the peripheral bus when core is reading URXD register
  88. * with receive interface disabled (RXEN=0 or UARTEN=0).
  89. */
  90. typedef union _hw_uart_urxd
  91. {
  92. reg32_t U;
  93. struct _hw_uart_urxd_bitfields
  94. {
  95. unsigned RX_DATA : 8; //!< [7:0] Received Data .
  96. unsigned RESERVED0 : 2; //!< [9:8] Reserved
  97. unsigned PRERR : 1; //!< [10] In RS-485 mode, it holds the ninth data bit (bit [8]) of received 9-bit RS-485 data
  98. unsigned BRK : 1; //!< [11] BREAK Detect.
  99. unsigned FRMERR : 1; //!< [12] Frame Error.
  100. unsigned OVRRUN : 1; //!< [13] Receiver Overrun.
  101. unsigned ERR : 1; //!< [14] Error Detect.
  102. unsigned CHARRDY : 1; //!< [15] Character Ready.
  103. unsigned RESERVED1 : 16; //!< [31:16] Reserved
  104. } B;
  105. } hw_uart_urxd_t;
  106. #endif
  107. /*!
  108. * @name Constants and macros for entire UART_URXD register
  109. */
  110. //@{
  111. #define HW_UART_URXD_ADDR(x) (REGS_UART_BASE(x) + 0x0)
  112. #ifndef __LANGUAGE_ASM__
  113. #define HW_UART_URXD(x) (*(volatile hw_uart_urxd_t *) HW_UART_URXD_ADDR(x))
  114. #define HW_UART_URXD_RD(x) (HW_UART_URXD(x).U)
  115. #endif
  116. //@}
  117. /*
  118. * constants & macros for individual UART_URXD bitfields
  119. */
  120. /*! @name Register UART_URXD, field RX_DATA[7:0] (RO)
  121. *
  122. * Received Data . Holds the received character. In 7-bit mode, the most significant bit (MSB) is
  123. * forced to 0. In 8-bit mode, all bits are active.
  124. */
  125. //@{
  126. #define BP_UART_URXD_RX_DATA (0) //!< Bit position for UART_URXD_RX_DATA.
  127. #define BM_UART_URXD_RX_DATA (0x000000ff) //!< Bit mask for UART_URXD_RX_DATA.
  128. //! @brief Get value of UART_URXD_RX_DATA from a register value.
  129. #define BG_UART_URXD_RX_DATA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_RX_DATA) >> BP_UART_URXD_RX_DATA)
  130. //@}
  131. /*! @name Register UART_URXD, field PRERR[10] (RO)
  132. *
  133. * In RS-485 mode, it holds the ninth data bit (bit [8]) of received 9-bit RS-485 data In RS232/IrDA
  134. * mode, it is the Parity Error flag . Indicates whether the current character was detected with a
  135. * parity error and is possibly corrupted. PRERR is updated for each character read from the RxFIFO.
  136. * When parity is disabled, PRERR always reads as 0.
  137. *
  138. * Values:
  139. * - 0 - = No parity error was detected for data in the RX_DATA field
  140. * - 1 - = A parity error was detected for data in the RX_DATA field
  141. */
  142. //@{
  143. #define BP_UART_URXD_PRERR (10) //!< Bit position for UART_URXD_PRERR.
  144. #define BM_UART_URXD_PRERR (0x00000400) //!< Bit mask for UART_URXD_PRERR.
  145. //! @brief Get value of UART_URXD_PRERR from a register value.
  146. #define BG_UART_URXD_PRERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_PRERR) >> BP_UART_URXD_PRERR)
  147. //@}
  148. /*! @name Register UART_URXD, field BRK[11] (RO)
  149. *
  150. * BREAK Detect. Indicates whether the current character was detected as a BREAK character. The data
  151. * bits and the stop bit are all 0. The FRMERR bit is set when BRK is set. When odd parity is
  152. * selected, PRERR is also set when BRK is set. BRK is valid for each character read from the
  153. * RxFIFO.
  154. *
  155. * Values:
  156. * - 0 - The current character is not a BREAK character
  157. * - 1 - The current character is a BREAK character
  158. */
  159. //@{
  160. #define BP_UART_URXD_BRK (11) //!< Bit position for UART_URXD_BRK.
  161. #define BM_UART_URXD_BRK (0x00000800) //!< Bit mask for UART_URXD_BRK.
  162. //! @brief Get value of UART_URXD_BRK from a register value.
  163. #define BG_UART_URXD_BRK(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_BRK) >> BP_UART_URXD_BRK)
  164. //@}
  165. /*! @name Register UART_URXD, field FRMERR[12] (RO)
  166. *
  167. * Frame Error. Indicates whether the current character had a framing error (a missing stop bit) and
  168. * is possibly corrupted. FRMERR is updated for each character read from the RxFIFO.
  169. *
  170. * Values:
  171. * - 0 - The current character has no framing error
  172. * - 1 - The current character has a framing error
  173. */
  174. //@{
  175. #define BP_UART_URXD_FRMERR (12) //!< Bit position for UART_URXD_FRMERR.
  176. #define BM_UART_URXD_FRMERR (0x00001000) //!< Bit mask for UART_URXD_FRMERR.
  177. //! @brief Get value of UART_URXD_FRMERR from a register value.
  178. #define BG_UART_URXD_FRMERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_FRMERR) >> BP_UART_URXD_FRMERR)
  179. //@}
  180. /*! @name Register UART_URXD, field OVRRUN[13] (RO)
  181. *
  182. * Receiver Overrun. This read-only bit, when HIGH, indicates that the corresponding character was
  183. * stored in the last position (32nd) of the Rx FIFO. Even if a 33rd character has not been
  184. * detected, this bit will be set to '1' for the 32nd character.
  185. *
  186. * Values:
  187. * - 0 - No RxFIFO overrun was detected
  188. * - 1 - A RxFIFO overrun was detected
  189. */
  190. //@{
  191. #define BP_UART_URXD_OVRRUN (13) //!< Bit position for UART_URXD_OVRRUN.
  192. #define BM_UART_URXD_OVRRUN (0x00002000) //!< Bit mask for UART_URXD_OVRRUN.
  193. //! @brief Get value of UART_URXD_OVRRUN from a register value.
  194. #define BG_UART_URXD_OVRRUN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_OVRRUN) >> BP_UART_URXD_OVRRUN)
  195. //@}
  196. /*! @name Register UART_URXD, field ERR[14] (RO)
  197. *
  198. * Error Detect. Indicates whether the character present in the RX_DATA field has an error (OVRRUN,
  199. * FRMERR, BRK or PRERR) status. The ERR bit is updated and valid for each received character.
  200. *
  201. * Values:
  202. * - 0 - No error status was detected
  203. * - 1 - An error status was detected
  204. */
  205. //@{
  206. #define BP_UART_URXD_ERR (14) //!< Bit position for UART_URXD_ERR.
  207. #define BM_UART_URXD_ERR (0x00004000) //!< Bit mask for UART_URXD_ERR.
  208. //! @brief Get value of UART_URXD_ERR from a register value.
  209. #define BG_UART_URXD_ERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_ERR) >> BP_UART_URXD_ERR)
  210. //@}
  211. /*! @name Register UART_URXD, field CHARRDY[15] (RO)
  212. *
  213. * Character Ready. This read-only bit indicates an invalid read when the FIFO becomes empty and
  214. * software tries to read the same old data. This bit should not be used for polling for data
  215. * written to the RX FIFO.
  216. *
  217. * Values:
  218. * - 0 - Character in RX_DATA field and associated flags are invalid.
  219. * - 1 - Character in RX_DATA field and associated flags valid and ready for reading.
  220. */
  221. //@{
  222. #define BP_UART_URXD_CHARRDY (15) //!< Bit position for UART_URXD_CHARRDY.
  223. #define BM_UART_URXD_CHARRDY (0x00008000) //!< Bit mask for UART_URXD_CHARRDY.
  224. //! @brief Get value of UART_URXD_CHARRDY from a register value.
  225. #define BG_UART_URXD_CHARRDY(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_URXD_CHARRDY) >> BP_UART_URXD_CHARRDY)
  226. //@}
  227. //-------------------------------------------------------------------------------------------
  228. // HW_UART_UTXD - UART Transmitter Register
  229. //-------------------------------------------------------------------------------------------
  230. #ifndef __LANGUAGE_ASM__
  231. /*!
  232. * @brief HW_UART_UTXD - UART Transmitter Register (WO)
  233. *
  234. * Reset value: 0x00000000
  235. *
  236. * The UART will yield a transfer error on the peripheral bus when core is writing into UART_URXD
  237. * register with transmit interface disabled (TXEN=0 or UARTEN=0). Memory space between UART_URXD
  238. * and UART_UTXD registers is reserved. Any read or write access to this space will be considered as
  239. * an invalid access and yield a transfer error .
  240. */
  241. typedef union _hw_uart_utxd
  242. {
  243. reg32_t U;
  244. struct _hw_uart_utxd_bitfields
  245. {
  246. unsigned TX_DATA : 8; //!< [7:0] Transmit Data .
  247. unsigned RESERVED0 : 24; //!< [31:8] Reserved.
  248. } B;
  249. } hw_uart_utxd_t;
  250. #endif
  251. /*!
  252. * @name Constants and macros for entire UART_UTXD register
  253. */
  254. //@{
  255. #define HW_UART_UTXD_ADDR(x) (REGS_UART_BASE(x) + 0x40)
  256. #ifndef __LANGUAGE_ASM__
  257. #define HW_UART_UTXD(x) (*(volatile hw_uart_utxd_t *) HW_UART_UTXD_ADDR(x))
  258. #define HW_UART_UTXD_WR(x, v) (HW_UART_UTXD(x).U = (v))
  259. #endif
  260. //@}
  261. /*
  262. * constants & macros for individual UART_UTXD bitfields
  263. */
  264. /*! @name Register UART_UTXD, field TX_DATA[7:0] (WO)
  265. *
  266. * Transmit Data . Holds the parallel transmit data inputs. In 7-bit mode, D7 is ignored. In 8-bit
  267. * mode, all bits are used. Data is transmitted least significant bit (LSB) first. A new character
  268. * is transmitted when the TX_DATA field is written. The TX_DATA field must be written only when the
  269. * TRDY bit is high to ensure that corrupted data is not sent.
  270. */
  271. //@{
  272. #define BP_UART_UTXD_TX_DATA (0) //!< Bit position for UART_UTXD_TX_DATA.
  273. #define BM_UART_UTXD_TX_DATA (0x000000ff) //!< Bit mask for UART_UTXD_TX_DATA.
  274. //! @brief Get value of UART_UTXD_TX_DATA from a register value.
  275. #define BG_UART_UTXD_TX_DATA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTXD_TX_DATA) >> BP_UART_UTXD_TX_DATA)
  276. //! @brief Format value for bitfield UART_UTXD_TX_DATA.
  277. #define BF_UART_UTXD_TX_DATA(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTXD_TX_DATA) & BM_UART_UTXD_TX_DATA)
  278. //@}
  279. //-------------------------------------------------------------------------------------------
  280. // HW_UART_UCR1 - UART Control Register 1
  281. //-------------------------------------------------------------------------------------------
  282. #ifndef __LANGUAGE_ASM__
  283. /*!
  284. * @brief HW_UART_UCR1 - UART Control Register 1 (RW)
  285. *
  286. * Reset value: 0x00000000
  287. */
  288. typedef union _hw_uart_ucr1
  289. {
  290. reg32_t U;
  291. struct _hw_uart_ucr1_bitfields
  292. {
  293. unsigned UARTEN : 1; //!< [0] UART Enable .
  294. unsigned DOZE : 1; //!< [1] DOZE .
  295. unsigned ATDMAEN : 1; //!< [2] Aging DMA Timer Enable .
  296. unsigned TXDMAEN : 1; //!< [3] Transmitter Ready DMA Enable .
  297. unsigned SNDBRK : 1; //!< [4] Send BREAK .
  298. unsigned RTSDEN : 1; //!< [5] RTS Delta Interrupt Enable .
  299. unsigned TXMPTYEN : 1; //!< [6] Transmitter Empty Interrupt Enable .
  300. unsigned IREN : 1; //!< [7] Infrared Interface Enable .
  301. unsigned RXDMAEN : 1; //!< [8] Receive Ready DMA Enable .
  302. unsigned RRDYEN : 1; //!< [9] Receiver Ready Interrupt Enable .
  303. unsigned ICD : 2; //!< [11:10] Idle Condition Detect .
  304. unsigned IDEN : 1; //!< [12] Idle Condition Detected Interrupt Enable .
  305. unsigned TRDYEN : 1; //!< [13] Transmitter Ready Interrupt Enable .
  306. unsigned ADBR : 1; //!< [14] Automatic Detection of Baud Rate .
  307. unsigned ADEN : 1; //!< [15] Automatic Baud Rate Detection Interrupt Enable .
  308. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  309. } B;
  310. } hw_uart_ucr1_t;
  311. #endif
  312. /*!
  313. * @name Constants and macros for entire UART_UCR1 register
  314. */
  315. //@{
  316. #define HW_UART_UCR1_ADDR(x) (REGS_UART_BASE(x) + 0x80)
  317. #ifndef __LANGUAGE_ASM__
  318. #define HW_UART_UCR1(x) (*(volatile hw_uart_ucr1_t *) HW_UART_UCR1_ADDR(x))
  319. #define HW_UART_UCR1_RD(x) (HW_UART_UCR1(x).U)
  320. #define HW_UART_UCR1_WR(x, v) (HW_UART_UCR1(x).U = (v))
  321. #define HW_UART_UCR1_SET(x, v) (HW_UART_UCR1_WR(x, HW_UART_UCR1_RD(x) | (v)))
  322. #define HW_UART_UCR1_CLR(x, v) (HW_UART_UCR1_WR(x, HW_UART_UCR1_RD(x) & ~(v)))
  323. #define HW_UART_UCR1_TOG(x, v) (HW_UART_UCR1_WR(x, HW_UART_UCR1_RD(x) ^ (v)))
  324. #endif
  325. //@}
  326. /*
  327. * constants & macros for individual UART_UCR1 bitfields
  328. */
  329. /*! @name Register UART_UCR1, field UARTEN[0] (RW)
  330. *
  331. * UART Enable . Enables/Disables the UART. If UARTEN is negated in the middle of a transmission,
  332. * the transmitter stops and pulls the TXD line to a logic 1. UARTEN must be set to 1 before any
  333. * access to UTXD and URXD registers, otherwise a transfer error is returned. This bit can be set to
  334. * 1 along with other bits in this register. There is no restriction to the sequence of programing
  335. * this bit and other control registers.
  336. *
  337. * Values:
  338. * - 0 - Disable the UART
  339. * - 1 - Enable the UART
  340. */
  341. //@{
  342. #define BP_UART_UCR1_UARTEN (0) //!< Bit position for UART_UCR1_UARTEN.
  343. #define BM_UART_UCR1_UARTEN (0x00000001) //!< Bit mask for UART_UCR1_UARTEN.
  344. //! @brief Get value of UART_UCR1_UARTEN from a register value.
  345. #define BG_UART_UCR1_UARTEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_UARTEN) >> BP_UART_UCR1_UARTEN)
  346. //! @brief Format value for bitfield UART_UCR1_UARTEN.
  347. #define BF_UART_UCR1_UARTEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_UARTEN) & BM_UART_UCR1_UARTEN)
  348. #ifndef __LANGUAGE_ASM__
  349. //! @brief Set the UARTEN field to a new value.
  350. #define BW_UART_UCR1_UARTEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_UARTEN) | BF_UART_UCR1_UARTEN(v)))
  351. #endif
  352. //@}
  353. /*! @name Register UART_UCR1, field DOZE[1] (RW)
  354. *
  355. * DOZE . Determines the UART enable condition in the DOZE state. When doze_req input pin is at '1',
  356. * (the ARM Platform executes a doze instruction and the system is placed in the Doze State), the
  357. * DOZE bit affects operation of the UART. While in the Doze State, if this bit is asserted, the
  358. * UART is disabled. See the description in .
  359. *
  360. * Values:
  361. * - 0 - The UART is enabled when in DOZE state
  362. * - 1 - The UART is disabled when in DOZE state
  363. */
  364. //@{
  365. #define BP_UART_UCR1_DOZE (1) //!< Bit position for UART_UCR1_DOZE.
  366. #define BM_UART_UCR1_DOZE (0x00000002) //!< Bit mask for UART_UCR1_DOZE.
  367. //! @brief Get value of UART_UCR1_DOZE from a register value.
  368. #define BG_UART_UCR1_DOZE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_DOZE) >> BP_UART_UCR1_DOZE)
  369. //! @brief Format value for bitfield UART_UCR1_DOZE.
  370. #define BF_UART_UCR1_DOZE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_DOZE) & BM_UART_UCR1_DOZE)
  371. #ifndef __LANGUAGE_ASM__
  372. //! @brief Set the DOZE field to a new value.
  373. #define BW_UART_UCR1_DOZE(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_DOZE) | BF_UART_UCR1_DOZE(v)))
  374. #endif
  375. //@}
  376. /*! @name Register UART_UCR1, field ATDMAEN[2] (RW)
  377. *
  378. * Aging DMA Timer Enable . Enables/Disables the receive DMA request dma_req_rx for the aging timer
  379. * interrupt (triggered with AGTIM flag in USR1[8]).
  380. *
  381. * Values:
  382. * - 0 - Disable AGTIM DMA request
  383. * - 1 - Enable AGTIM DMA request
  384. */
  385. //@{
  386. #define BP_UART_UCR1_ATDMAEN (2) //!< Bit position for UART_UCR1_ATDMAEN.
  387. #define BM_UART_UCR1_ATDMAEN (0x00000004) //!< Bit mask for UART_UCR1_ATDMAEN.
  388. //! @brief Get value of UART_UCR1_ATDMAEN from a register value.
  389. #define BG_UART_UCR1_ATDMAEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_ATDMAEN) >> BP_UART_UCR1_ATDMAEN)
  390. //! @brief Format value for bitfield UART_UCR1_ATDMAEN.
  391. #define BF_UART_UCR1_ATDMAEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_ATDMAEN) & BM_UART_UCR1_ATDMAEN)
  392. #ifndef __LANGUAGE_ASM__
  393. //! @brief Set the ATDMAEN field to a new value.
  394. #define BW_UART_UCR1_ATDMAEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_ATDMAEN) | BF_UART_UCR1_ATDMAEN(v)))
  395. #endif
  396. //@}
  397. /*! @name Register UART_UCR1, field TXDMAEN[3] (RW)
  398. *
  399. * Transmitter Ready DMA Enable . Enables/Disables the transmit DMA request dma_req_tx when the
  400. * transmitter has one or more slots available in the TxFIFO. The fill level in the TxFIFO that
  401. * generates the dma_req_tx is controlled by the TXTL bits. A DMA request will be issued as long as
  402. * TXDMAEN and TRDY are high even if the transmitter is not enabled. In general, user should enable
  403. * the transmitter before enabling the transmit DMA request.
  404. *
  405. * Values:
  406. * - 0 - Disable transmit DMA request
  407. * - 1 - Enable transmit DMA request
  408. */
  409. //@{
  410. #define BP_UART_UCR1_TXDMAEN (3) //!< Bit position for UART_UCR1_TXDMAEN.
  411. #define BM_UART_UCR1_TXDMAEN (0x00000008) //!< Bit mask for UART_UCR1_TXDMAEN.
  412. //! @brief Get value of UART_UCR1_TXDMAEN from a register value.
  413. #define BG_UART_UCR1_TXDMAEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_TXDMAEN) >> BP_UART_UCR1_TXDMAEN)
  414. //! @brief Format value for bitfield UART_UCR1_TXDMAEN.
  415. #define BF_UART_UCR1_TXDMAEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_TXDMAEN) & BM_UART_UCR1_TXDMAEN)
  416. #ifndef __LANGUAGE_ASM__
  417. //! @brief Set the TXDMAEN field to a new value.
  418. #define BW_UART_UCR1_TXDMAEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_TXDMAEN) | BF_UART_UCR1_TXDMAEN(v)))
  419. #endif
  420. //@}
  421. /*! @name Register UART_UCR1, field SNDBRK[4] (RW)
  422. *
  423. * Send BREAK . Forces the transmitter to send a BREAK character. The transmitter finishes sending
  424. * the character in progress (if any) and sends BREAK characters until SNDBRK is reset. Because the
  425. * transmitter samples SNDBRK after every bit is transmitted, it is important that SNDBRK is
  426. * asserted high for a sufficient period of time to generate a valid BREAK. After the BREAK
  427. * transmission completes, the UART transmits 2 mark bits. The user can continue to fill the TxFIFO
  428. * and any characters remaining are transmitted when the BREAK is terminated.
  429. *
  430. * Values:
  431. * - 0 - Do not send a BREAK character
  432. * - 1 - Send a BREAK character (continuous 0s)
  433. */
  434. //@{
  435. #define BP_UART_UCR1_SNDBRK (4) //!< Bit position for UART_UCR1_SNDBRK.
  436. #define BM_UART_UCR1_SNDBRK (0x00000010) //!< Bit mask for UART_UCR1_SNDBRK.
  437. //! @brief Get value of UART_UCR1_SNDBRK from a register value.
  438. #define BG_UART_UCR1_SNDBRK(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_SNDBRK) >> BP_UART_UCR1_SNDBRK)
  439. //! @brief Format value for bitfield UART_UCR1_SNDBRK.
  440. #define BF_UART_UCR1_SNDBRK(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_SNDBRK) & BM_UART_UCR1_SNDBRK)
  441. #ifndef __LANGUAGE_ASM__
  442. //! @brief Set the SNDBRK field to a new value.
  443. #define BW_UART_UCR1_SNDBRK(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_SNDBRK) | BF_UART_UCR1_SNDBRK(v)))
  444. #endif
  445. //@}
  446. /*! @name Register UART_UCR1, field RTSDEN[5] (RW)
  447. *
  448. * RTS Delta Interrupt Enable . Enables/Disables the RTSD interrupt. The current status of the RTS
  449. * pin is read in the RTSS bit.
  450. *
  451. * Values:
  452. * - 0 - Disable RTSD interrupt
  453. * - 1 - Enable RTSD interrupt
  454. */
  455. //@{
  456. #define BP_UART_UCR1_RTSDEN (5) //!< Bit position for UART_UCR1_RTSDEN.
  457. #define BM_UART_UCR1_RTSDEN (0x00000020) //!< Bit mask for UART_UCR1_RTSDEN.
  458. //! @brief Get value of UART_UCR1_RTSDEN from a register value.
  459. #define BG_UART_UCR1_RTSDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_RTSDEN) >> BP_UART_UCR1_RTSDEN)
  460. //! @brief Format value for bitfield UART_UCR1_RTSDEN.
  461. #define BF_UART_UCR1_RTSDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_RTSDEN) & BM_UART_UCR1_RTSDEN)
  462. #ifndef __LANGUAGE_ASM__
  463. //! @brief Set the RTSDEN field to a new value.
  464. #define BW_UART_UCR1_RTSDEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_RTSDEN) | BF_UART_UCR1_RTSDEN(v)))
  465. #endif
  466. //@}
  467. /*! @name Register UART_UCR1, field TXMPTYEN[6] (RW)
  468. *
  469. * Transmitter Empty Interrupt Enable . Enables/Disables the transmitter FIFO empty (TXFE)
  470. * interrupt. interrupt_uart . When negated, the TXFE interrupt is disabled. An interrupt will be
  471. * issued as long as TXMPTYEN and TXFE are high even if the transmitter is not enabled. In general,
  472. * user should enable the transmitter before enabling the TXFE interrupt.
  473. *
  474. * Values:
  475. * - 0 - Disable the transmitter FIFO empty interrupt
  476. * - 1 - Enable the transmitter FIFO empty interrupt
  477. */
  478. //@{
  479. #define BP_UART_UCR1_TXMPTYEN (6) //!< Bit position for UART_UCR1_TXMPTYEN.
  480. #define BM_UART_UCR1_TXMPTYEN (0x00000040) //!< Bit mask for UART_UCR1_TXMPTYEN.
  481. //! @brief Get value of UART_UCR1_TXMPTYEN from a register value.
  482. #define BG_UART_UCR1_TXMPTYEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_TXMPTYEN) >> BP_UART_UCR1_TXMPTYEN)
  483. //! @brief Format value for bitfield UART_UCR1_TXMPTYEN.
  484. #define BF_UART_UCR1_TXMPTYEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_TXMPTYEN) & BM_UART_UCR1_TXMPTYEN)
  485. #ifndef __LANGUAGE_ASM__
  486. //! @brief Set the TXMPTYEN field to a new value.
  487. #define BW_UART_UCR1_TXMPTYEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_TXMPTYEN) | BF_UART_UCR1_TXMPTYEN(v)))
  488. #endif
  489. //@}
  490. /*! @name Register UART_UCR1, field IREN[7] (RW)
  491. *
  492. * Infrared Interface Enable . Enables/Disables the IR interface. See the IR interface description
  493. * in , for more information. Note: MDEN(UMCR[0]) must be cleared to 0 when using IrDA interface.
  494. * See
  495. *
  496. * Values:
  497. * - 0 - Disable the IR interface
  498. * - 1 - Enable the IR interface
  499. */
  500. //@{
  501. #define BP_UART_UCR1_IREN (7) //!< Bit position for UART_UCR1_IREN.
  502. #define BM_UART_UCR1_IREN (0x00000080) //!< Bit mask for UART_UCR1_IREN.
  503. //! @brief Get value of UART_UCR1_IREN from a register value.
  504. #define BG_UART_UCR1_IREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_IREN) >> BP_UART_UCR1_IREN)
  505. //! @brief Format value for bitfield UART_UCR1_IREN.
  506. #define BF_UART_UCR1_IREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_IREN) & BM_UART_UCR1_IREN)
  507. #ifndef __LANGUAGE_ASM__
  508. //! @brief Set the IREN field to a new value.
  509. #define BW_UART_UCR1_IREN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_IREN) | BF_UART_UCR1_IREN(v)))
  510. #endif
  511. //@}
  512. /*! @name Register UART_UCR1, field RXDMAEN[8] (RW)
  513. *
  514. * Receive Ready DMA Enable . Enables/Disables the receive DMA request dma_req_rx when the receiver
  515. * has data in the RxFIFO. The fill level in the RxFIFO at which a DMA request is generated is
  516. * controlled by the RXTL bits. When negated, the receive DMA request is disabled.
  517. *
  518. * Values:
  519. * - 0 - Disable DMA request
  520. * - 1 - Enable DMA request
  521. */
  522. //@{
  523. #define BP_UART_UCR1_RXDMAEN (8) //!< Bit position for UART_UCR1_RXDMAEN.
  524. #define BM_UART_UCR1_RXDMAEN (0x00000100) //!< Bit mask for UART_UCR1_RXDMAEN.
  525. //! @brief Get value of UART_UCR1_RXDMAEN from a register value.
  526. #define BG_UART_UCR1_RXDMAEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_RXDMAEN) >> BP_UART_UCR1_RXDMAEN)
  527. //! @brief Format value for bitfield UART_UCR1_RXDMAEN.
  528. #define BF_UART_UCR1_RXDMAEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_RXDMAEN) & BM_UART_UCR1_RXDMAEN)
  529. #ifndef __LANGUAGE_ASM__
  530. //! @brief Set the RXDMAEN field to a new value.
  531. #define BW_UART_UCR1_RXDMAEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_RXDMAEN) | BF_UART_UCR1_RXDMAEN(v)))
  532. #endif
  533. //@}
  534. /*! @name Register UART_UCR1, field RRDYEN[9] (RW)
  535. *
  536. * Receiver Ready Interrupt Enable . Enables/Disables the RRDY interrupt when the RxFIFO contains
  537. * data. The fill level in the RxFIFO at which an interrupt is generated is controlled by the RXTL
  538. * bits. When RRDYEN is negated, the receiver ready interrupt is disabled.
  539. *
  540. * Values:
  541. * - 0 - Disables the RRDY interrupt
  542. * - 1 - Enables the RRDY interrupt
  543. */
  544. //@{
  545. #define BP_UART_UCR1_RRDYEN (9) //!< Bit position for UART_UCR1_RRDYEN.
  546. #define BM_UART_UCR1_RRDYEN (0x00000200) //!< Bit mask for UART_UCR1_RRDYEN.
  547. //! @brief Get value of UART_UCR1_RRDYEN from a register value.
  548. #define BG_UART_UCR1_RRDYEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_RRDYEN) >> BP_UART_UCR1_RRDYEN)
  549. //! @brief Format value for bitfield UART_UCR1_RRDYEN.
  550. #define BF_UART_UCR1_RRDYEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_RRDYEN) & BM_UART_UCR1_RRDYEN)
  551. #ifndef __LANGUAGE_ASM__
  552. //! @brief Set the RRDYEN field to a new value.
  553. #define BW_UART_UCR1_RRDYEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_RRDYEN) | BF_UART_UCR1_RRDYEN(v)))
  554. #endif
  555. //@}
  556. /*! @name Register UART_UCR1, field ICD[11:10] (RW)
  557. *
  558. * Idle Condition Detect . Controls the number of frames RXD is allowed to be idle before an idle
  559. * condition is reported.
  560. *
  561. * Values:
  562. * - 00 - Idle for more than 4 frames
  563. * - 01 - Idle for more than 8 frames
  564. * - 10 - Idle for more than 16 frames
  565. * - 11 - Idle for more than 32 frames
  566. */
  567. //@{
  568. #define BP_UART_UCR1_ICD (10) //!< Bit position for UART_UCR1_ICD.
  569. #define BM_UART_UCR1_ICD (0x00000c00) //!< Bit mask for UART_UCR1_ICD.
  570. //! @brief Get value of UART_UCR1_ICD from a register value.
  571. #define BG_UART_UCR1_ICD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_ICD) >> BP_UART_UCR1_ICD)
  572. //! @brief Format value for bitfield UART_UCR1_ICD.
  573. #define BF_UART_UCR1_ICD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_ICD) & BM_UART_UCR1_ICD)
  574. #ifndef __LANGUAGE_ASM__
  575. //! @brief Set the ICD field to a new value.
  576. #define BW_UART_UCR1_ICD(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_ICD) | BF_UART_UCR1_ICD(v)))
  577. #endif
  578. //@}
  579. /*! @name Register UART_UCR1, field IDEN[12] (RW)
  580. *
  581. * Idle Condition Detected Interrupt Enable . Enables/Disables the IDLE bit to generate an interrupt
  582. * ( interrupt_uart = 0).
  583. *
  584. * Values:
  585. * - 0 - Disable the IDLE interrupt
  586. * - 1 - Enable the IDLE interrupt
  587. */
  588. //@{
  589. #define BP_UART_UCR1_IDEN (12) //!< Bit position for UART_UCR1_IDEN.
  590. #define BM_UART_UCR1_IDEN (0x00001000) //!< Bit mask for UART_UCR1_IDEN.
  591. //! @brief Get value of UART_UCR1_IDEN from a register value.
  592. #define BG_UART_UCR1_IDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_IDEN) >> BP_UART_UCR1_IDEN)
  593. //! @brief Format value for bitfield UART_UCR1_IDEN.
  594. #define BF_UART_UCR1_IDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_IDEN) & BM_UART_UCR1_IDEN)
  595. #ifndef __LANGUAGE_ASM__
  596. //! @brief Set the IDEN field to a new value.
  597. #define BW_UART_UCR1_IDEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_IDEN) | BF_UART_UCR1_IDEN(v)))
  598. #endif
  599. //@}
  600. /*! @name Register UART_UCR1, field TRDYEN[13] (RW)
  601. *
  602. * Transmitter Ready Interrupt Enable . Enables/Disables the transmitter Ready Interrupt (TRDY) when
  603. * the transmitter has one or more slots available in the TxFIFO. The fill level in the TXFIFO at
  604. * which an interrupt is generated is controlled by TxTL bits. When TRDYEN is negated, the
  605. * transmitter ready interrupt is disabled. An interrupt will be issued as long as TRDYEN and TRDY
  606. * are high even if the transmitter is not enabled. In general, user should enable the transmitter
  607. * before enabling the TRDY interrupt.
  608. *
  609. * Values:
  610. * - 0 - Disable the transmitter ready interrupt
  611. * - 1 - Enable the transmitter ready interrupt
  612. */
  613. //@{
  614. #define BP_UART_UCR1_TRDYEN (13) //!< Bit position for UART_UCR1_TRDYEN.
  615. #define BM_UART_UCR1_TRDYEN (0x00002000) //!< Bit mask for UART_UCR1_TRDYEN.
  616. //! @brief Get value of UART_UCR1_TRDYEN from a register value.
  617. #define BG_UART_UCR1_TRDYEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_TRDYEN) >> BP_UART_UCR1_TRDYEN)
  618. //! @brief Format value for bitfield UART_UCR1_TRDYEN.
  619. #define BF_UART_UCR1_TRDYEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_TRDYEN) & BM_UART_UCR1_TRDYEN)
  620. #ifndef __LANGUAGE_ASM__
  621. //! @brief Set the TRDYEN field to a new value.
  622. #define BW_UART_UCR1_TRDYEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_TRDYEN) | BF_UART_UCR1_TRDYEN(v)))
  623. #endif
  624. //@}
  625. /*! @name Register UART_UCR1, field ADBR[14] (RW)
  626. *
  627. * Automatic Detection of Baud Rate . Enables/Disables automatic baud rate detection. When the ADBR
  628. * bit is set and the ADET bit is cleared, the receiver detects the incoming baud rate
  629. * automatically. The ADET flag is set when the receiver verifies that the incoming baud rate is
  630. * detected properly by detecting an ASCII character "A" or "a" (0x41 or 0x61).
  631. *
  632. * Values:
  633. * - 0 - Disable automatic detection of baud rate
  634. * - 1 - Enable automatic detection of baud rate
  635. */
  636. //@{
  637. #define BP_UART_UCR1_ADBR (14) //!< Bit position for UART_UCR1_ADBR.
  638. #define BM_UART_UCR1_ADBR (0x00004000) //!< Bit mask for UART_UCR1_ADBR.
  639. //! @brief Get value of UART_UCR1_ADBR from a register value.
  640. #define BG_UART_UCR1_ADBR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_ADBR) >> BP_UART_UCR1_ADBR)
  641. //! @brief Format value for bitfield UART_UCR1_ADBR.
  642. #define BF_UART_UCR1_ADBR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_ADBR) & BM_UART_UCR1_ADBR)
  643. #ifndef __LANGUAGE_ASM__
  644. //! @brief Set the ADBR field to a new value.
  645. #define BW_UART_UCR1_ADBR(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_ADBR) | BF_UART_UCR1_ADBR(v)))
  646. #endif
  647. //@}
  648. /*! @name Register UART_UCR1, field ADEN[15] (RW)
  649. *
  650. * Automatic Baud Rate Detection Interrupt Enable . Enables/Disables the automatic baud rate detect
  651. * complete (ADET) bit to generate an interrupt ( interrupt_uart = 0).
  652. *
  653. * Values:
  654. * - 0 - Disable the automatic baud rate detection interrupt
  655. * - 1 - Enable the automatic baud rate detection interrupt
  656. */
  657. //@{
  658. #define BP_UART_UCR1_ADEN (15) //!< Bit position for UART_UCR1_ADEN.
  659. #define BM_UART_UCR1_ADEN (0x00008000) //!< Bit mask for UART_UCR1_ADEN.
  660. //! @brief Get value of UART_UCR1_ADEN from a register value.
  661. #define BG_UART_UCR1_ADEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR1_ADEN) >> BP_UART_UCR1_ADEN)
  662. //! @brief Format value for bitfield UART_UCR1_ADEN.
  663. #define BF_UART_UCR1_ADEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR1_ADEN) & BM_UART_UCR1_ADEN)
  664. #ifndef __LANGUAGE_ASM__
  665. //! @brief Set the ADEN field to a new value.
  666. #define BW_UART_UCR1_ADEN(x, v) (HW_UART_UCR1_WR(x, (HW_UART_UCR1_RD(x) & ~BM_UART_UCR1_ADEN) | BF_UART_UCR1_ADEN(v)))
  667. #endif
  668. //@}
  669. //-------------------------------------------------------------------------------------------
  670. // HW_UART_UCR2 - UART Control Register 2
  671. //-------------------------------------------------------------------------------------------
  672. #ifndef __LANGUAGE_ASM__
  673. /*!
  674. * @brief HW_UART_UCR2 - UART Control Register 2 (RW)
  675. *
  676. * Reset value: 0x00000001
  677. */
  678. typedef union _hw_uart_ucr2
  679. {
  680. reg32_t U;
  681. struct _hw_uart_ucr2_bitfields
  682. {
  683. unsigned SRST : 1; //!< [0] Software Reset .
  684. unsigned RXEN : 1; //!< [1] Receiver Enable .
  685. unsigned TXEN : 1; //!< [2] Transmitter Enable .
  686. unsigned ATEN : 1; //!< [3] Aging Timer Enable .
  687. unsigned RTSEN : 1; //!< [4] Request to Send Interrupt Enable.
  688. unsigned WS : 1; //!< [5] Word Size .
  689. unsigned STPB : 1; //!< [6] Stop .
  690. unsigned PROE : 1; //!< [7] Parity Odd/Even .
  691. unsigned PREN : 1; //!< [8] Parity Enable .
  692. unsigned RTEC : 2; //!< [10:9] Request to Send Edge Control .
  693. unsigned ESCEN : 1; //!< [11] Escape Enable .
  694. unsigned CTS : 1; //!< [12] Clear to Send .
  695. unsigned CTSC : 1; //!< [13] CTS Pin Control .
  696. unsigned IRTS : 1; //!< [14] Ignore RTS Pin .
  697. unsigned ESCI : 1; //!< [15] Escape Sequence Interrupt Enable .
  698. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  699. } B;
  700. } hw_uart_ucr2_t;
  701. #endif
  702. /*!
  703. * @name Constants and macros for entire UART_UCR2 register
  704. */
  705. //@{
  706. #define HW_UART_UCR2_ADDR(x) (REGS_UART_BASE(x) + 0x84)
  707. #ifndef __LANGUAGE_ASM__
  708. #define HW_UART_UCR2(x) (*(volatile hw_uart_ucr2_t *) HW_UART_UCR2_ADDR(x))
  709. #define HW_UART_UCR2_RD(x) (HW_UART_UCR2(x).U)
  710. #define HW_UART_UCR2_WR(x, v) (HW_UART_UCR2(x).U = (v))
  711. #define HW_UART_UCR2_SET(x, v) (HW_UART_UCR2_WR(x, HW_UART_UCR2_RD(x) | (v)))
  712. #define HW_UART_UCR2_CLR(x, v) (HW_UART_UCR2_WR(x, HW_UART_UCR2_RD(x) & ~(v)))
  713. #define HW_UART_UCR2_TOG(x, v) (HW_UART_UCR2_WR(x, HW_UART_UCR2_RD(x) ^ (v)))
  714. #endif
  715. //@}
  716. /*
  717. * constants & macros for individual UART_UCR2 bitfields
  718. */
  719. /*! @name Register UART_UCR2, field SRST[0] (RW)
  720. *
  721. * Software Reset . Once the software writes 0 to SRST , the software reset remains active for 4
  722. * module_clock cycles before the hardware deasserts SRST . The software can only write 0 to SRST .
  723. * Writing 1 to SRST is ignored.
  724. *
  725. * Values:
  726. * - 0 - Reset the transmit and receive state machines, all FIFOs and register USR1, USR2, UBIR, UBMR, UBRC ,
  727. * URXD, UTXD and UTS[6-3].
  728. * - 1 - No reset
  729. */
  730. //@{
  731. #define BP_UART_UCR2_SRST (0) //!< Bit position for UART_UCR2_SRST.
  732. #define BM_UART_UCR2_SRST (0x00000001) //!< Bit mask for UART_UCR2_SRST.
  733. //! @brief Get value of UART_UCR2_SRST from a register value.
  734. #define BG_UART_UCR2_SRST(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_SRST) >> BP_UART_UCR2_SRST)
  735. //! @brief Format value for bitfield UART_UCR2_SRST.
  736. #define BF_UART_UCR2_SRST(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_SRST) & BM_UART_UCR2_SRST)
  737. #ifndef __LANGUAGE_ASM__
  738. //! @brief Set the SRST field to a new value.
  739. #define BW_UART_UCR2_SRST(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_SRST) | BF_UART_UCR2_SRST(v)))
  740. #endif
  741. //@}
  742. /*! @name Register UART_UCR2, field RXEN[1] (RW)
  743. *
  744. * Receiver Enable . Enables/Disables the receiver. When the receiver is enabled, if the RXD input
  745. * is already low, the receiver does not recognize BREAK characters, because it requires a valid
  746. * 1-to-0 transition before it can accept any character.
  747. *
  748. * Values:
  749. * - 0 - Disable the receiver
  750. * - 1 - Enable the receiver
  751. */
  752. //@{
  753. #define BP_UART_UCR2_RXEN (1) //!< Bit position for UART_UCR2_RXEN.
  754. #define BM_UART_UCR2_RXEN (0x00000002) //!< Bit mask for UART_UCR2_RXEN.
  755. //! @brief Get value of UART_UCR2_RXEN from a register value.
  756. #define BG_UART_UCR2_RXEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_RXEN) >> BP_UART_UCR2_RXEN)
  757. //! @brief Format value for bitfield UART_UCR2_RXEN.
  758. #define BF_UART_UCR2_RXEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_RXEN) & BM_UART_UCR2_RXEN)
  759. #ifndef __LANGUAGE_ASM__
  760. //! @brief Set the RXEN field to a new value.
  761. #define BW_UART_UCR2_RXEN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_RXEN) | BF_UART_UCR2_RXEN(v)))
  762. #endif
  763. //@}
  764. /*! @name Register UART_UCR2, field TXEN[2] (RW)
  765. *
  766. * Transmitter Enable . Enables/Disables the transmitter. When TXEN is negated the transmitter is
  767. * disabled and idle. When the UARTEN and TXEN bits are set the transmitter is enabled. If TXEN is
  768. * negated in the middle of a transmission, the UART disables the transmitter immediately, and
  769. * starts marking 1s. The transmitter FIFO cannot be written when this bit is cleared.
  770. *
  771. * Values:
  772. * - 0 - Disable the transmitter
  773. * - 1 - Enable the transmitter
  774. */
  775. //@{
  776. #define BP_UART_UCR2_TXEN (2) //!< Bit position for UART_UCR2_TXEN.
  777. #define BM_UART_UCR2_TXEN (0x00000004) //!< Bit mask for UART_UCR2_TXEN.
  778. //! @brief Get value of UART_UCR2_TXEN from a register value.
  779. #define BG_UART_UCR2_TXEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_TXEN) >> BP_UART_UCR2_TXEN)
  780. //! @brief Format value for bitfield UART_UCR2_TXEN.
  781. #define BF_UART_UCR2_TXEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_TXEN) & BM_UART_UCR2_TXEN)
  782. #ifndef __LANGUAGE_ASM__
  783. //! @brief Set the TXEN field to a new value.
  784. #define BW_UART_UCR2_TXEN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_TXEN) | BF_UART_UCR2_TXEN(v)))
  785. #endif
  786. //@}
  787. /*! @name Register UART_UCR2, field ATEN[3] (RW)
  788. *
  789. * Aging Timer Enable . This bit is used to enable the aging timer interrupt (triggered with AGTIM)
  790. *
  791. * Values:
  792. * - 0 - AGTIM interrupt disabled
  793. * - 1 - AGTIM interrupt enabled
  794. */
  795. //@{
  796. #define BP_UART_UCR2_ATEN (3) //!< Bit position for UART_UCR2_ATEN.
  797. #define BM_UART_UCR2_ATEN (0x00000008) //!< Bit mask for UART_UCR2_ATEN.
  798. //! @brief Get value of UART_UCR2_ATEN from a register value.
  799. #define BG_UART_UCR2_ATEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_ATEN) >> BP_UART_UCR2_ATEN)
  800. //! @brief Format value for bitfield UART_UCR2_ATEN.
  801. #define BF_UART_UCR2_ATEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_ATEN) & BM_UART_UCR2_ATEN)
  802. #ifndef __LANGUAGE_ASM__
  803. //! @brief Set the ATEN field to a new value.
  804. #define BW_UART_UCR2_ATEN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_ATEN) | BF_UART_UCR2_ATEN(v)))
  805. #endif
  806. //@}
  807. /*! @name Register UART_UCR2, field RTSEN[4] (RW)
  808. *
  809. * Request to Send Interrupt Enable. Controls the RTS edge sensitive interrupt. When RTSEN is
  810. * asserted and the programmed edge is detected on the RTS pin (the RTSF bit is asserted), an
  811. * interrupt will be generated on the interrupt_uart pin. (See .)
  812. *
  813. * Values:
  814. * - 0 - Disable request to send interrupt
  815. * - 1 - Enable request to send interrupt
  816. */
  817. //@{
  818. #define BP_UART_UCR2_RTSEN (4) //!< Bit position for UART_UCR2_RTSEN.
  819. #define BM_UART_UCR2_RTSEN (0x00000010) //!< Bit mask for UART_UCR2_RTSEN.
  820. //! @brief Get value of UART_UCR2_RTSEN from a register value.
  821. #define BG_UART_UCR2_RTSEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_RTSEN) >> BP_UART_UCR2_RTSEN)
  822. //! @brief Format value for bitfield UART_UCR2_RTSEN.
  823. #define BF_UART_UCR2_RTSEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_RTSEN) & BM_UART_UCR2_RTSEN)
  824. #ifndef __LANGUAGE_ASM__
  825. //! @brief Set the RTSEN field to a new value.
  826. #define BW_UART_UCR2_RTSEN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_RTSEN) | BF_UART_UCR2_RTSEN(v)))
  827. #endif
  828. //@}
  829. /*! @name Register UART_UCR2, field WS[5] (RW)
  830. *
  831. * Word Size . Controls the character length. When WS is high, the transmitter and receiver are in
  832. * 8-bit mode. When WS is low, they are in 7-bit mode. The transmitter ignores bit 7 and the
  833. * receiver sets bit 7 to 0. WS can be changed in-between transmission (reception) of characters,
  834. * however not when a transmission (reception) is in progress, in which case the length of the
  835. * current character being transmitted (received) is unpredictable.
  836. *
  837. * Values:
  838. * - 0 - 7-bit transmit and receive character length (not including START, STOP or PARITY bits)
  839. * - 1 - 8-bit transmit and receive character length (not including START, STOP or PARITY bits)
  840. */
  841. //@{
  842. #define BP_UART_UCR2_WS (5) //!< Bit position for UART_UCR2_WS.
  843. #define BM_UART_UCR2_WS (0x00000020) //!< Bit mask for UART_UCR2_WS.
  844. //! @brief Get value of UART_UCR2_WS from a register value.
  845. #define BG_UART_UCR2_WS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_WS) >> BP_UART_UCR2_WS)
  846. //! @brief Format value for bitfield UART_UCR2_WS.
  847. #define BF_UART_UCR2_WS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_WS) & BM_UART_UCR2_WS)
  848. #ifndef __LANGUAGE_ASM__
  849. //! @brief Set the WS field to a new value.
  850. #define BW_UART_UCR2_WS(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_WS) | BF_UART_UCR2_WS(v)))
  851. #endif
  852. //@}
  853. /*! @name Register UART_UCR2, field STPB[6] (RW)
  854. *
  855. * Stop . Controls the number of stop bits after a character. When STPB is low, 1 stop bit is sent.
  856. * When STPB is high, 2 stop bits are sent. STPB also affects the receiver.
  857. *
  858. * Values:
  859. * - 0 - The transmitter sends 1 stop bit. The receiver expects 1 or more stop bits.
  860. * - 1 - The transmitter sends 2 stop bits. The receiver expects 2 or more stop bits.
  861. */
  862. //@{
  863. #define BP_UART_UCR2_STPB (6) //!< Bit position for UART_UCR2_STPB.
  864. #define BM_UART_UCR2_STPB (0x00000040) //!< Bit mask for UART_UCR2_STPB.
  865. //! @brief Get value of UART_UCR2_STPB from a register value.
  866. #define BG_UART_UCR2_STPB(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_STPB) >> BP_UART_UCR2_STPB)
  867. //! @brief Format value for bitfield UART_UCR2_STPB.
  868. #define BF_UART_UCR2_STPB(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_STPB) & BM_UART_UCR2_STPB)
  869. #ifndef __LANGUAGE_ASM__
  870. //! @brief Set the STPB field to a new value.
  871. #define BW_UART_UCR2_STPB(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_STPB) | BF_UART_UCR2_STPB(v)))
  872. #endif
  873. //@}
  874. /*! @name Register UART_UCR2, field PROE[7] (RW)
  875. *
  876. * Parity Odd/Even . Controls the sense of the parity generator and checker. When PROE is high, odd
  877. * parity is generated and expected. When PROE is low, even parity is generated and expected. PROE
  878. * has no function if PREN is low.
  879. *
  880. * Values:
  881. * - 0 - Even parity
  882. * - 1 - Odd parity
  883. */
  884. //@{
  885. #define BP_UART_UCR2_PROE (7) //!< Bit position for UART_UCR2_PROE.
  886. #define BM_UART_UCR2_PROE (0x00000080) //!< Bit mask for UART_UCR2_PROE.
  887. //! @brief Get value of UART_UCR2_PROE from a register value.
  888. #define BG_UART_UCR2_PROE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_PROE) >> BP_UART_UCR2_PROE)
  889. //! @brief Format value for bitfield UART_UCR2_PROE.
  890. #define BF_UART_UCR2_PROE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_PROE) & BM_UART_UCR2_PROE)
  891. #ifndef __LANGUAGE_ASM__
  892. //! @brief Set the PROE field to a new value.
  893. #define BW_UART_UCR2_PROE(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_PROE) | BF_UART_UCR2_PROE(v)))
  894. #endif
  895. //@}
  896. /*! @name Register UART_UCR2, field PREN[8] (RW)
  897. *
  898. * Parity Enable . Enables/Disables the parity generator in the transmitter and parity checker in
  899. * the receiver. When PREN is asserted, the parity generator and checker are enabled, and disabled
  900. * when PREN is negated.
  901. *
  902. * Values:
  903. * - 0 - Disable parity generator and checker
  904. * - 1 - Enable parity generator and checker
  905. */
  906. //@{
  907. #define BP_UART_UCR2_PREN (8) //!< Bit position for UART_UCR2_PREN.
  908. #define BM_UART_UCR2_PREN (0x00000100) //!< Bit mask for UART_UCR2_PREN.
  909. //! @brief Get value of UART_UCR2_PREN from a register value.
  910. #define BG_UART_UCR2_PREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_PREN) >> BP_UART_UCR2_PREN)
  911. //! @brief Format value for bitfield UART_UCR2_PREN.
  912. #define BF_UART_UCR2_PREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_PREN) & BM_UART_UCR2_PREN)
  913. #ifndef __LANGUAGE_ASM__
  914. //! @brief Set the PREN field to a new value.
  915. #define BW_UART_UCR2_PREN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_PREN) | BF_UART_UCR2_PREN(v)))
  916. #endif
  917. //@}
  918. /*! @name Register UART_UCR2, field RTEC[10:9] (RW)
  919. *
  920. * Request to Send Edge Control . Selects the edge that triggers the RTS interrupt. This has no
  921. * effect on the RTS delta interrupt. RTEC has an effect only when RTSEN = 1 (see ).
  922. *
  923. * Values:
  924. * - 00 - Trigger interrupt on a rising edge
  925. * - 01 - Trigger interrupt on a falling edge
  926. * - 1X - Trigger interrupt on any edge
  927. */
  928. //@{
  929. #define BP_UART_UCR2_RTEC (9) //!< Bit position for UART_UCR2_RTEC.
  930. #define BM_UART_UCR2_RTEC (0x00000600) //!< Bit mask for UART_UCR2_RTEC.
  931. //! @brief Get value of UART_UCR2_RTEC from a register value.
  932. #define BG_UART_UCR2_RTEC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_RTEC) >> BP_UART_UCR2_RTEC)
  933. //! @brief Format value for bitfield UART_UCR2_RTEC.
  934. #define BF_UART_UCR2_RTEC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_RTEC) & BM_UART_UCR2_RTEC)
  935. #ifndef __LANGUAGE_ASM__
  936. //! @brief Set the RTEC field to a new value.
  937. #define BW_UART_UCR2_RTEC(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_RTEC) | BF_UART_UCR2_RTEC(v)))
  938. #endif
  939. //@}
  940. /*! @name Register UART_UCR2, field ESCEN[11] (RW)
  941. *
  942. * Escape Enable . Enables/Disables the escape sequence detection logic.
  943. *
  944. * Values:
  945. * - 0 - Disable escape sequence detection
  946. * - 1 - Enable escape sequence detection
  947. */
  948. //@{
  949. #define BP_UART_UCR2_ESCEN (11) //!< Bit position for UART_UCR2_ESCEN.
  950. #define BM_UART_UCR2_ESCEN (0x00000800) //!< Bit mask for UART_UCR2_ESCEN.
  951. //! @brief Get value of UART_UCR2_ESCEN from a register value.
  952. #define BG_UART_UCR2_ESCEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_ESCEN) >> BP_UART_UCR2_ESCEN)
  953. //! @brief Format value for bitfield UART_UCR2_ESCEN.
  954. #define BF_UART_UCR2_ESCEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_ESCEN) & BM_UART_UCR2_ESCEN)
  955. #ifndef __LANGUAGE_ASM__
  956. //! @brief Set the ESCEN field to a new value.
  957. #define BW_UART_UCR2_ESCEN(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_ESCEN) | BF_UART_UCR2_ESCEN(v)))
  958. #endif
  959. //@}
  960. /*! @name Register UART_UCR2, field CTS[12] (RW)
  961. *
  962. * Clear to Send . Controls the CTS pin when the CTSC bit is negated. CTS has no function when CTSC
  963. * is asserted.
  964. *
  965. * Values:
  966. * - 0 - The CTS pin is high (inactive)
  967. * - 1 - The CTS pin is low (active)
  968. */
  969. //@{
  970. #define BP_UART_UCR2_CTS (12) //!< Bit position for UART_UCR2_CTS.
  971. #define BM_UART_UCR2_CTS (0x00001000) //!< Bit mask for UART_UCR2_CTS.
  972. //! @brief Get value of UART_UCR2_CTS from a register value.
  973. #define BG_UART_UCR2_CTS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_CTS) >> BP_UART_UCR2_CTS)
  974. //! @brief Format value for bitfield UART_UCR2_CTS.
  975. #define BF_UART_UCR2_CTS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_CTS) & BM_UART_UCR2_CTS)
  976. #ifndef __LANGUAGE_ASM__
  977. //! @brief Set the CTS field to a new value.
  978. #define BW_UART_UCR2_CTS(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_CTS) | BF_UART_UCR2_CTS(v)))
  979. #endif
  980. //@}
  981. /*! @name Register UART_UCR2, field CTSC[13] (RW)
  982. *
  983. * CTS Pin Control . Controls the operation of the CTS output pin. When CTSC is asserted, the CTS
  984. * output pin is controlled by the receiver. When the RxFIFO is filled to the level of the
  985. * programmed trigger level and the start bit of the overflowing character (TRIGGER LEVEL + 1) is
  986. * validated, the CTS output pin is negated to indicate to the far-end transmitter to stop
  987. * transmitting. When the trigger level is programmed for less than 32, the receiver continues to
  988. * receive data until the RxFIFO is full. When the CTSC bit is negated, the CTS output pin is
  989. * controlled by the CTS bit. On reset, because CTSC is cleared to 0, the CTS pin is controlled by
  990. * the CTS bit, which again is cleared to 0 on reset. This means that on reset the CTS signal is
  991. * negated.
  992. *
  993. * Values:
  994. * - 0 - The CTS pin is controlled by the CTS bit
  995. * - 1 - The CTS pin is controlled by the receiver
  996. */
  997. //@{
  998. #define BP_UART_UCR2_CTSC (13) //!< Bit position for UART_UCR2_CTSC.
  999. #define BM_UART_UCR2_CTSC (0x00002000) //!< Bit mask for UART_UCR2_CTSC.
  1000. //! @brief Get value of UART_UCR2_CTSC from a register value.
  1001. #define BG_UART_UCR2_CTSC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_CTSC) >> BP_UART_UCR2_CTSC)
  1002. //! @brief Format value for bitfield UART_UCR2_CTSC.
  1003. #define BF_UART_UCR2_CTSC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_CTSC) & BM_UART_UCR2_CTSC)
  1004. #ifndef __LANGUAGE_ASM__
  1005. //! @brief Set the CTSC field to a new value.
  1006. #define BW_UART_UCR2_CTSC(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_CTSC) | BF_UART_UCR2_CTSC(v)))
  1007. #endif
  1008. //@}
  1009. /*! @name Register UART_UCR2, field IRTS[14] (RW)
  1010. *
  1011. * Ignore RTS Pin . Forces the RTS input signal presented to the transmitter to always be asserted
  1012. * (set to low), effectively ignoring the external pin. When in this mode, the RTS pin serves as a
  1013. * general purpose input.
  1014. *
  1015. * Values:
  1016. * - 0 - Transmit only when the RTS pin is asserted
  1017. * - 1 - Ignore the RTS pin
  1018. */
  1019. //@{
  1020. #define BP_UART_UCR2_IRTS (14) //!< Bit position for UART_UCR2_IRTS.
  1021. #define BM_UART_UCR2_IRTS (0x00004000) //!< Bit mask for UART_UCR2_IRTS.
  1022. //! @brief Get value of UART_UCR2_IRTS from a register value.
  1023. #define BG_UART_UCR2_IRTS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_IRTS) >> BP_UART_UCR2_IRTS)
  1024. //! @brief Format value for bitfield UART_UCR2_IRTS.
  1025. #define BF_UART_UCR2_IRTS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_IRTS) & BM_UART_UCR2_IRTS)
  1026. #ifndef __LANGUAGE_ASM__
  1027. //! @brief Set the IRTS field to a new value.
  1028. #define BW_UART_UCR2_IRTS(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_IRTS) | BF_UART_UCR2_IRTS(v)))
  1029. #endif
  1030. //@}
  1031. /*! @name Register UART_UCR2, field ESCI[15] (RW)
  1032. *
  1033. * Escape Sequence Interrupt Enable . Enables/Disables the ESCF bit to generate an interrupt.
  1034. *
  1035. * Values:
  1036. * - 0 - Disable the escape sequence interrupt
  1037. * - 1 - Enable the escape sequence interrupt
  1038. */
  1039. //@{
  1040. #define BP_UART_UCR2_ESCI (15) //!< Bit position for UART_UCR2_ESCI.
  1041. #define BM_UART_UCR2_ESCI (0x00008000) //!< Bit mask for UART_UCR2_ESCI.
  1042. //! @brief Get value of UART_UCR2_ESCI from a register value.
  1043. #define BG_UART_UCR2_ESCI(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR2_ESCI) >> BP_UART_UCR2_ESCI)
  1044. //! @brief Format value for bitfield UART_UCR2_ESCI.
  1045. #define BF_UART_UCR2_ESCI(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR2_ESCI) & BM_UART_UCR2_ESCI)
  1046. #ifndef __LANGUAGE_ASM__
  1047. //! @brief Set the ESCI field to a new value.
  1048. #define BW_UART_UCR2_ESCI(x, v) (HW_UART_UCR2_WR(x, (HW_UART_UCR2_RD(x) & ~BM_UART_UCR2_ESCI) | BF_UART_UCR2_ESCI(v)))
  1049. #endif
  1050. //@}
  1051. //-------------------------------------------------------------------------------------------
  1052. // HW_UART_UCR3 - UART Control Register 3
  1053. //-------------------------------------------------------------------------------------------
  1054. #ifndef __LANGUAGE_ASM__
  1055. /*!
  1056. * @brief HW_UART_UCR3 - UART Control Register 3 (RW)
  1057. *
  1058. * Reset value: 0x00000700
  1059. */
  1060. typedef union _hw_uart_ucr3
  1061. {
  1062. reg32_t U;
  1063. struct _hw_uart_ucr3_bitfields
  1064. {
  1065. unsigned ACIEN : 1; //!< [0] Autobaud Counter Interrupt Enable.
  1066. unsigned INVT : 1; //!< [1] Invert TXD output in RS-232/RS-485 mode, set TXD active level in IrDA mode.
  1067. unsigned RXDMUXSEL : 1; //!< [2] RXD Muxed Input Selected.
  1068. unsigned DTRDEN : 1; //!< [3] Data Terminal Ready Delta Enable .
  1069. unsigned AWAKEN : 1; //!< [4] Asynchronous WAKE Interrupt Enable.
  1070. unsigned AIRINTEN : 1; //!< [5] Asynchronous IR WAKE Interrupt Enable.
  1071. unsigned RXDSEN : 1; //!< [6] Receive Status Interrupt Enable.
  1072. unsigned ADNIMP : 1; //!< [7] Autobaud Detection Not Improved-.
  1073. unsigned RI : 1; //!< [8] Ring Indicator .
  1074. unsigned DCD : 1; //!< [9] Data Carrier Detect .
  1075. unsigned DSR : 1; //!< [10] Data Set Ready .
  1076. unsigned FRAERREN : 1; //!< [11] Frame Error Interrupt Enable.
  1077. unsigned PARERREN : 1; //!< [12] Parity Error Interrupt Enable.
  1078. unsigned DTREN : 1; //!< [13] Data Terminal Ready Interrupt Enable .
  1079. unsigned DPEC : 2; //!< [15:14] DTR/DSR Interrupt Edge Control .
  1080. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  1081. } B;
  1082. } hw_uart_ucr3_t;
  1083. #endif
  1084. /*!
  1085. * @name Constants and macros for entire UART_UCR3 register
  1086. */
  1087. //@{
  1088. #define HW_UART_UCR3_ADDR(x) (REGS_UART_BASE(x) + 0x88)
  1089. #ifndef __LANGUAGE_ASM__
  1090. #define HW_UART_UCR3(x) (*(volatile hw_uart_ucr3_t *) HW_UART_UCR3_ADDR(x))
  1091. #define HW_UART_UCR3_RD(x) (HW_UART_UCR3(x).U)
  1092. #define HW_UART_UCR3_WR(x, v) (HW_UART_UCR3(x).U = (v))
  1093. #define HW_UART_UCR3_SET(x, v) (HW_UART_UCR3_WR(x, HW_UART_UCR3_RD(x) | (v)))
  1094. #define HW_UART_UCR3_CLR(x, v) (HW_UART_UCR3_WR(x, HW_UART_UCR3_RD(x) & ~(v)))
  1095. #define HW_UART_UCR3_TOG(x, v) (HW_UART_UCR3_WR(x, HW_UART_UCR3_RD(x) ^ (v)))
  1096. #endif
  1097. //@}
  1098. /*
  1099. * constants & macros for individual UART_UCR3 bitfields
  1100. */
  1101. /*! @name Register UART_UCR3, field ACIEN[0] (RW)
  1102. *
  1103. * Autobaud Counter Interrupt Enable. This bit is used to enable the autobaud counter stopped
  1104. * interrupt (triggered with ACST (USR2[11]).
  1105. *
  1106. * Values:
  1107. * - 0 - ACST interrupt disabled
  1108. * - 1 - ACST interrupt enabled
  1109. */
  1110. //@{
  1111. #define BP_UART_UCR3_ACIEN (0) //!< Bit position for UART_UCR3_ACIEN.
  1112. #define BM_UART_UCR3_ACIEN (0x00000001) //!< Bit mask for UART_UCR3_ACIEN.
  1113. //! @brief Get value of UART_UCR3_ACIEN from a register value.
  1114. #define BG_UART_UCR3_ACIEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_ACIEN) >> BP_UART_UCR3_ACIEN)
  1115. //! @brief Format value for bitfield UART_UCR3_ACIEN.
  1116. #define BF_UART_UCR3_ACIEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_ACIEN) & BM_UART_UCR3_ACIEN)
  1117. #ifndef __LANGUAGE_ASM__
  1118. //! @brief Set the ACIEN field to a new value.
  1119. #define BW_UART_UCR3_ACIEN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_ACIEN) | BF_UART_UCR3_ACIEN(v)))
  1120. #endif
  1121. //@}
  1122. /*! @name Register UART_UCR3, field INVT[1] (RW)
  1123. *
  1124. * Invert TXD output in RS-232/RS-485 mode, set TXD active level in IrDA mode. In RS232/RS-485
  1125. * mode(UMCR[0] = 1), if this bit is set to 1, the TXD output is inverted before transmitted. In
  1126. * IrDA mode , when INVT is cleared, the infrared logic block transmits a positive IR 3/16 pulse for
  1127. * all 0s and 0s are transmitted for 1s. When INVT is set (INVT = 1), the infrared logic block
  1128. * transmits an active low or negative infrared 3/16 pulse for all 0s and 1s are transmitted for 1s.
  1129. *
  1130. * Values:
  1131. * - 0 - TXD is not inverted
  1132. * - 0 - TXD Active low transmission
  1133. * - 1 - TXD is inverted
  1134. * - 1 - TXD Active high transmission
  1135. */
  1136. //@{
  1137. #define BP_UART_UCR3_INVT (1) //!< Bit position for UART_UCR3_INVT.
  1138. #define BM_UART_UCR3_INVT (0x00000002) //!< Bit mask for UART_UCR3_INVT.
  1139. //! @brief Get value of UART_UCR3_INVT from a register value.
  1140. #define BG_UART_UCR3_INVT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_INVT) >> BP_UART_UCR3_INVT)
  1141. //! @brief Format value for bitfield UART_UCR3_INVT.
  1142. #define BF_UART_UCR3_INVT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_INVT) & BM_UART_UCR3_INVT)
  1143. #ifndef __LANGUAGE_ASM__
  1144. //! @brief Set the INVT field to a new value.
  1145. #define BW_UART_UCR3_INVT(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_INVT) | BF_UART_UCR3_INVT(v)))
  1146. #endif
  1147. //@}
  1148. /*! @name Register UART_UCR3, field RXDMUXSEL[2] (RW)
  1149. *
  1150. * RXD Muxed Input Selected. Selects proper input pins for serial and Infrared input signal. In this
  1151. * chip, UARTs are used in MUXED mode, so that this bit should always be set.
  1152. */
  1153. //@{
  1154. #define BP_UART_UCR3_RXDMUXSEL (2) //!< Bit position for UART_UCR3_RXDMUXSEL.
  1155. #define BM_UART_UCR3_RXDMUXSEL (0x00000004) //!< Bit mask for UART_UCR3_RXDMUXSEL.
  1156. //! @brief Get value of UART_UCR3_RXDMUXSEL from a register value.
  1157. #define BG_UART_UCR3_RXDMUXSEL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_RXDMUXSEL) >> BP_UART_UCR3_RXDMUXSEL)
  1158. //! @brief Format value for bitfield UART_UCR3_RXDMUXSEL.
  1159. #define BF_UART_UCR3_RXDMUXSEL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_RXDMUXSEL) & BM_UART_UCR3_RXDMUXSEL)
  1160. #ifndef __LANGUAGE_ASM__
  1161. //! @brief Set the RXDMUXSEL field to a new value.
  1162. #define BW_UART_UCR3_RXDMUXSEL(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_RXDMUXSEL) | BF_UART_UCR3_RXDMUXSEL(v)))
  1163. #endif
  1164. //@}
  1165. /*! @name Register UART_UCR3, field DTRDEN[3] (RW)
  1166. *
  1167. * Data Terminal Ready Delta Enable . Enables / Disables the asynchronous DTRD interrupt. When
  1168. * DTRDEN is asserted and an edge (rising or falling) is detected on DTR (in DCE mode) or on DSR (in
  1169. * DTE mode), then an interrupt is generated.
  1170. *
  1171. * Values:
  1172. * - 0 - Disable DTRD interrupt
  1173. * - 1 - Enable DTRD interrupt
  1174. */
  1175. //@{
  1176. #define BP_UART_UCR3_DTRDEN (3) //!< Bit position for UART_UCR3_DTRDEN.
  1177. #define BM_UART_UCR3_DTRDEN (0x00000008) //!< Bit mask for UART_UCR3_DTRDEN.
  1178. //! @brief Get value of UART_UCR3_DTRDEN from a register value.
  1179. #define BG_UART_UCR3_DTRDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_DTRDEN) >> BP_UART_UCR3_DTRDEN)
  1180. //! @brief Format value for bitfield UART_UCR3_DTRDEN.
  1181. #define BF_UART_UCR3_DTRDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_DTRDEN) & BM_UART_UCR3_DTRDEN)
  1182. #ifndef __LANGUAGE_ASM__
  1183. //! @brief Set the DTRDEN field to a new value.
  1184. #define BW_UART_UCR3_DTRDEN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_DTRDEN) | BF_UART_UCR3_DTRDEN(v)))
  1185. #endif
  1186. //@}
  1187. /*! @name Register UART_UCR3, field AWAKEN[4] (RW)
  1188. *
  1189. * Asynchronous WAKE Interrupt Enable. Controls the asynchronous WAKE interrupt. An interrupt is
  1190. * generated when AWAKEN is asserted and a falling edge is detected on the RXD pin.
  1191. *
  1192. * Values:
  1193. * - 0 - Disable the AWAKE interrupt
  1194. * - 1 - Enable the AWAKE interrupt
  1195. */
  1196. //@{
  1197. #define BP_UART_UCR3_AWAKEN (4) //!< Bit position for UART_UCR3_AWAKEN.
  1198. #define BM_UART_UCR3_AWAKEN (0x00000010) //!< Bit mask for UART_UCR3_AWAKEN.
  1199. //! @brief Get value of UART_UCR3_AWAKEN from a register value.
  1200. #define BG_UART_UCR3_AWAKEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_AWAKEN) >> BP_UART_UCR3_AWAKEN)
  1201. //! @brief Format value for bitfield UART_UCR3_AWAKEN.
  1202. #define BF_UART_UCR3_AWAKEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_AWAKEN) & BM_UART_UCR3_AWAKEN)
  1203. #ifndef __LANGUAGE_ASM__
  1204. //! @brief Set the AWAKEN field to a new value.
  1205. #define BW_UART_UCR3_AWAKEN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_AWAKEN) | BF_UART_UCR3_AWAKEN(v)))
  1206. #endif
  1207. //@}
  1208. /*! @name Register UART_UCR3, field AIRINTEN[5] (RW)
  1209. *
  1210. * Asynchronous IR WAKE Interrupt Enable. Controls the asynchronous IR WAKE interrupt. An interrupt
  1211. * is generated when AIRINTEN is asserted and a pulse is detected on the RXD pin.
  1212. *
  1213. * Values:
  1214. * - 0 - Disable the AIRINT interrupt
  1215. * - 1 - Enable the AIRINT interrupt
  1216. */
  1217. //@{
  1218. #define BP_UART_UCR3_AIRINTEN (5) //!< Bit position for UART_UCR3_AIRINTEN.
  1219. #define BM_UART_UCR3_AIRINTEN (0x00000020) //!< Bit mask for UART_UCR3_AIRINTEN.
  1220. //! @brief Get value of UART_UCR3_AIRINTEN from a register value.
  1221. #define BG_UART_UCR3_AIRINTEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_AIRINTEN) >> BP_UART_UCR3_AIRINTEN)
  1222. //! @brief Format value for bitfield UART_UCR3_AIRINTEN.
  1223. #define BF_UART_UCR3_AIRINTEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_AIRINTEN) & BM_UART_UCR3_AIRINTEN)
  1224. #ifndef __LANGUAGE_ASM__
  1225. //! @brief Set the AIRINTEN field to a new value.
  1226. #define BW_UART_UCR3_AIRINTEN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_AIRINTEN) | BF_UART_UCR3_AIRINTEN(v)))
  1227. #endif
  1228. //@}
  1229. /*! @name Register UART_UCR3, field RXDSEN[6] (RW)
  1230. *
  1231. * Receive Status Interrupt Enable. Controls the receive status interrupt ( interrupt_uart ). When
  1232. * this bit is enabled and RXDS status bit is set, the interrupt interrupt_uart will be generated.
  1233. *
  1234. * Values:
  1235. * - 0 - Disable the RXDS interrupt
  1236. * - 1 - Enable the RXDS interrupt
  1237. */
  1238. //@{
  1239. #define BP_UART_UCR3_RXDSEN (6) //!< Bit position for UART_UCR3_RXDSEN.
  1240. #define BM_UART_UCR3_RXDSEN (0x00000040) //!< Bit mask for UART_UCR3_RXDSEN.
  1241. //! @brief Get value of UART_UCR3_RXDSEN from a register value.
  1242. #define BG_UART_UCR3_RXDSEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_RXDSEN) >> BP_UART_UCR3_RXDSEN)
  1243. //! @brief Format value for bitfield UART_UCR3_RXDSEN.
  1244. #define BF_UART_UCR3_RXDSEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_RXDSEN) & BM_UART_UCR3_RXDSEN)
  1245. #ifndef __LANGUAGE_ASM__
  1246. //! @brief Set the RXDSEN field to a new value.
  1247. #define BW_UART_UCR3_RXDSEN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_RXDSEN) | BF_UART_UCR3_RXDSEN(v)))
  1248. #endif
  1249. //@}
  1250. /*! @name Register UART_UCR3, field ADNIMP[7] (RW)
  1251. *
  1252. * Autobaud Detection Not Improved-. Disables new features of autobaud detection (See , for more
  1253. * details).
  1254. *
  1255. * Values:
  1256. * - 0 - Autobaud detection new features selected
  1257. * - 1 - Keep old autobaud detection mechanism
  1258. */
  1259. //@{
  1260. #define BP_UART_UCR3_ADNIMP (7) //!< Bit position for UART_UCR3_ADNIMP.
  1261. #define BM_UART_UCR3_ADNIMP (0x00000080) //!< Bit mask for UART_UCR3_ADNIMP.
  1262. //! @brief Get value of UART_UCR3_ADNIMP from a register value.
  1263. #define BG_UART_UCR3_ADNIMP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_ADNIMP) >> BP_UART_UCR3_ADNIMP)
  1264. //! @brief Format value for bitfield UART_UCR3_ADNIMP.
  1265. #define BF_UART_UCR3_ADNIMP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_ADNIMP) & BM_UART_UCR3_ADNIMP)
  1266. #ifndef __LANGUAGE_ASM__
  1267. //! @brief Set the ADNIMP field to a new value.
  1268. #define BW_UART_UCR3_ADNIMP(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_ADNIMP) | BF_UART_UCR3_ADNIMP(v)))
  1269. #endif
  1270. //@}
  1271. /*! @name Register UART_UCR3, field RI[8] (RW)
  1272. *
  1273. * Ring Indicator . In DCE mode this bit is used by software to control the RI output pin for the
  1274. * modem interface. In DTE mode, when this bit is set, it will enable the status bit RIDELT (USR2
  1275. * (10)) to cause an interrupt.
  1276. *
  1277. * Values:
  1278. * - 0 - RI pin is logic zero (DCE mode)
  1279. * - 0 - RIDELT interrupt disabled (DTE mode)
  1280. * - 1 - RI pin is logic one (DCE mode)
  1281. * - 1 - RIDELT interrupt enabled (DTE mode)
  1282. */
  1283. //@{
  1284. #define BP_UART_UCR3_RI (8) //!< Bit position for UART_UCR3_RI.
  1285. #define BM_UART_UCR3_RI (0x00000100) //!< Bit mask for UART_UCR3_RI.
  1286. //! @brief Get value of UART_UCR3_RI from a register value.
  1287. #define BG_UART_UCR3_RI(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_RI) >> BP_UART_UCR3_RI)
  1288. //! @brief Format value for bitfield UART_UCR3_RI.
  1289. #define BF_UART_UCR3_RI(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_RI) & BM_UART_UCR3_RI)
  1290. #ifndef __LANGUAGE_ASM__
  1291. //! @brief Set the RI field to a new value.
  1292. #define BW_UART_UCR3_RI(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_RI) | BF_UART_UCR3_RI(v)))
  1293. #endif
  1294. //@}
  1295. /*! @name Register UART_UCR3, field DCD[9] (RW)
  1296. *
  1297. * Data Carrier Detect . In DCE mode this bit is used by software to control the DCD output pin for
  1298. * the modem interface. In DTE mode, when this bit is set, it will enable the status bit DCDDELT
  1299. * (USR2 (6)) to cause an interrupt.
  1300. *
  1301. * Values:
  1302. * - 0 - DCD pin is logic zero (DCE mode)
  1303. * - 0 - DCDDELT interrupt disabled (DTE mode)
  1304. * - 1 - DCD pin is logic one (DCE mode)
  1305. * - 1 - DCDDELT interrupt enabled (DTE mode)
  1306. */
  1307. //@{
  1308. #define BP_UART_UCR3_DCD (9) //!< Bit position for UART_UCR3_DCD.
  1309. #define BM_UART_UCR3_DCD (0x00000200) //!< Bit mask for UART_UCR3_DCD.
  1310. //! @brief Get value of UART_UCR3_DCD from a register value.
  1311. #define BG_UART_UCR3_DCD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_DCD) >> BP_UART_UCR3_DCD)
  1312. //! @brief Format value for bitfield UART_UCR3_DCD.
  1313. #define BF_UART_UCR3_DCD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_DCD) & BM_UART_UCR3_DCD)
  1314. #ifndef __LANGUAGE_ASM__
  1315. //! @brief Set the DCD field to a new value.
  1316. #define BW_UART_UCR3_DCD(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_DCD) | BF_UART_UCR3_DCD(v)))
  1317. #endif
  1318. //@}
  1319. /*! @name Register UART_UCR3, field DSR[10] (RW)
  1320. *
  1321. * Data Set Ready . This bit is used by software to control the DSR/DTR output pin for the modem
  1322. * interface. In DCE mode it applies to DSR and in DTE mode it applies to DTR .
  1323. *
  1324. * Values:
  1325. * - 0 - DSR/ DTR pin is logic zero
  1326. * - 1 - DSR/ DTR pin is logic one
  1327. */
  1328. //@{
  1329. #define BP_UART_UCR3_DSR (10) //!< Bit position for UART_UCR3_DSR.
  1330. #define BM_UART_UCR3_DSR (0x00000400) //!< Bit mask for UART_UCR3_DSR.
  1331. //! @brief Get value of UART_UCR3_DSR from a register value.
  1332. #define BG_UART_UCR3_DSR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_DSR) >> BP_UART_UCR3_DSR)
  1333. //! @brief Format value for bitfield UART_UCR3_DSR.
  1334. #define BF_UART_UCR3_DSR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_DSR) & BM_UART_UCR3_DSR)
  1335. #ifndef __LANGUAGE_ASM__
  1336. //! @brief Set the DSR field to a new value.
  1337. #define BW_UART_UCR3_DSR(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_DSR) | BF_UART_UCR3_DSR(v)))
  1338. #endif
  1339. //@}
  1340. /*! @name Register UART_UCR3, field FRAERREN[11] (RW)
  1341. *
  1342. * Frame Error Interrupt Enable. Enables/Disables the interrupt. When asserted, FRAERREN causes the
  1343. * FRAMERR bit to generate an interrupt.
  1344. *
  1345. * Values:
  1346. * - 0 - Disable the frame error interrupt
  1347. * - 1 - Enable the frame error interrupt
  1348. */
  1349. //@{
  1350. #define BP_UART_UCR3_FRAERREN (11) //!< Bit position for UART_UCR3_FRAERREN.
  1351. #define BM_UART_UCR3_FRAERREN (0x00000800) //!< Bit mask for UART_UCR3_FRAERREN.
  1352. //! @brief Get value of UART_UCR3_FRAERREN from a register value.
  1353. #define BG_UART_UCR3_FRAERREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_FRAERREN) >> BP_UART_UCR3_FRAERREN)
  1354. //! @brief Format value for bitfield UART_UCR3_FRAERREN.
  1355. #define BF_UART_UCR3_FRAERREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_FRAERREN) & BM_UART_UCR3_FRAERREN)
  1356. #ifndef __LANGUAGE_ASM__
  1357. //! @brief Set the FRAERREN field to a new value.
  1358. #define BW_UART_UCR3_FRAERREN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_FRAERREN) | BF_UART_UCR3_FRAERREN(v)))
  1359. #endif
  1360. //@}
  1361. /*! @name Register UART_UCR3, field PARERREN[12] (RW)
  1362. *
  1363. * Parity Error Interrupt Enable. Enables/Disables the interrupt. When asserted, PARERREN causes the
  1364. * PARITYERR bit to generate an interrupt.
  1365. *
  1366. * Values:
  1367. * - 0 - Disable the parity error interrupt
  1368. * - 1 - Enable the parity error interrupt
  1369. */
  1370. //@{
  1371. #define BP_UART_UCR3_PARERREN (12) //!< Bit position for UART_UCR3_PARERREN.
  1372. #define BM_UART_UCR3_PARERREN (0x00001000) //!< Bit mask for UART_UCR3_PARERREN.
  1373. //! @brief Get value of UART_UCR3_PARERREN from a register value.
  1374. #define BG_UART_UCR3_PARERREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_PARERREN) >> BP_UART_UCR3_PARERREN)
  1375. //! @brief Format value for bitfield UART_UCR3_PARERREN.
  1376. #define BF_UART_UCR3_PARERREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_PARERREN) & BM_UART_UCR3_PARERREN)
  1377. #ifndef __LANGUAGE_ASM__
  1378. //! @brief Set the PARERREN field to a new value.
  1379. #define BW_UART_UCR3_PARERREN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_PARERREN) | BF_UART_UCR3_PARERREN(v)))
  1380. #endif
  1381. //@}
  1382. /*! @name Register UART_UCR3, field DTREN[13] (RW)
  1383. *
  1384. * Data Terminal Ready Interrupt Enable . When this bit is set, it will enable the status bit DTRF
  1385. * (USR2 [13]) (DTR/DSR edge sensitive interrupt) to cause an interrupt.
  1386. *
  1387. * Values:
  1388. * - 0 - Data Terminal Ready Interrupt Disabled
  1389. * - 1 - Data Terminal Ready Interrupt Enabled
  1390. */
  1391. //@{
  1392. #define BP_UART_UCR3_DTREN (13) //!< Bit position for UART_UCR3_DTREN.
  1393. #define BM_UART_UCR3_DTREN (0x00002000) //!< Bit mask for UART_UCR3_DTREN.
  1394. //! @brief Get value of UART_UCR3_DTREN from a register value.
  1395. #define BG_UART_UCR3_DTREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_DTREN) >> BP_UART_UCR3_DTREN)
  1396. //! @brief Format value for bitfield UART_UCR3_DTREN.
  1397. #define BF_UART_UCR3_DTREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_DTREN) & BM_UART_UCR3_DTREN)
  1398. #ifndef __LANGUAGE_ASM__
  1399. //! @brief Set the DTREN field to a new value.
  1400. #define BW_UART_UCR3_DTREN(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_DTREN) | BF_UART_UCR3_DTREN(v)))
  1401. #endif
  1402. //@}
  1403. /*! @name Register UART_UCR3, field DPEC[15:14] (RW)
  1404. *
  1405. * DTR/DSR Interrupt Edge Control . These bits control the edge of DTR (DCE) or DSR (DTE) on which
  1406. * an interrupt will be generated. An interrupt will only be generated if the DTREN bit is set.
  1407. *
  1408. * Values:
  1409. * - 00 - interrupt generated on rising edge
  1410. * - 01 - interrupt generated on falling edge
  1411. * - 1X - interrupt generated on either edge
  1412. */
  1413. //@{
  1414. #define BP_UART_UCR3_DPEC (14) //!< Bit position for UART_UCR3_DPEC.
  1415. #define BM_UART_UCR3_DPEC (0x0000c000) //!< Bit mask for UART_UCR3_DPEC.
  1416. //! @brief Get value of UART_UCR3_DPEC from a register value.
  1417. #define BG_UART_UCR3_DPEC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR3_DPEC) >> BP_UART_UCR3_DPEC)
  1418. //! @brief Format value for bitfield UART_UCR3_DPEC.
  1419. #define BF_UART_UCR3_DPEC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR3_DPEC) & BM_UART_UCR3_DPEC)
  1420. #ifndef __LANGUAGE_ASM__
  1421. //! @brief Set the DPEC field to a new value.
  1422. #define BW_UART_UCR3_DPEC(x, v) (HW_UART_UCR3_WR(x, (HW_UART_UCR3_RD(x) & ~BM_UART_UCR3_DPEC) | BF_UART_UCR3_DPEC(v)))
  1423. #endif
  1424. //@}
  1425. //-------------------------------------------------------------------------------------------
  1426. // HW_UART_UCR4 - UART Control Register 4
  1427. //-------------------------------------------------------------------------------------------
  1428. #ifndef __LANGUAGE_ASM__
  1429. /*!
  1430. * @brief HW_UART_UCR4 - UART Control Register 4 (RW)
  1431. *
  1432. * Reset value: 0x00008000
  1433. */
  1434. typedef union _hw_uart_ucr4
  1435. {
  1436. reg32_t U;
  1437. struct _hw_uart_ucr4_bitfields
  1438. {
  1439. unsigned DREN : 1; //!< [0] Receive Data Ready Interrupt Enable .
  1440. unsigned OREN : 1; //!< [1] Receiver Overrun Interrupt Enable .
  1441. unsigned BKEN : 1; //!< [2] BREAK Condition Detected Interrupt Enable .
  1442. unsigned TCEN : 1; //!< [3] Transmit Complete Interrupt Enable .
  1443. unsigned LPBYP : 1; //!< [4] Low Power Bypass .
  1444. unsigned IRSC : 1; //!< [5] IR Special Case .
  1445. unsigned IDDMAEN : 1; //!< [6] DMA IDLE Condition Detected Interrupt Enable Enables/Disables the receive DMA request dma_req_rx for the IDLE interrupt (triggered with IDLE flag in USR2[12]).
  1446. unsigned WKEN : 1; //!< [7] WAKE Interrupt Enable .
  1447. unsigned ENIRI : 1; //!< [8] Serial Infrared Interrupt Enable .
  1448. unsigned INVR : 1; //!< [9] Invert RXD input in RS-232/RS-485 Mode, d etermine RXD input logic level being sampled in In IrDA mode.
  1449. unsigned CTSTL : 6; //!< [15:10] CTS Trigger Level .
  1450. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  1451. } B;
  1452. } hw_uart_ucr4_t;
  1453. #endif
  1454. /*!
  1455. * @name Constants and macros for entire UART_UCR4 register
  1456. */
  1457. //@{
  1458. #define HW_UART_UCR4_ADDR(x) (REGS_UART_BASE(x) + 0x8c)
  1459. #ifndef __LANGUAGE_ASM__
  1460. #define HW_UART_UCR4(x) (*(volatile hw_uart_ucr4_t *) HW_UART_UCR4_ADDR(x))
  1461. #define HW_UART_UCR4_RD(x) (HW_UART_UCR4(x).U)
  1462. #define HW_UART_UCR4_WR(x, v) (HW_UART_UCR4(x).U = (v))
  1463. #define HW_UART_UCR4_SET(x, v) (HW_UART_UCR4_WR(x, HW_UART_UCR4_RD(x) | (v)))
  1464. #define HW_UART_UCR4_CLR(x, v) (HW_UART_UCR4_WR(x, HW_UART_UCR4_RD(x) & ~(v)))
  1465. #define HW_UART_UCR4_TOG(x, v) (HW_UART_UCR4_WR(x, HW_UART_UCR4_RD(x) ^ (v)))
  1466. #endif
  1467. //@}
  1468. /*
  1469. * constants & macros for individual UART_UCR4 bitfields
  1470. */
  1471. /*! @name Register UART_UCR4, field DREN[0] (RW)
  1472. *
  1473. * Receive Data Ready Interrupt Enable . Enables/Disables the RDR bit to generate an interrupt.
  1474. *
  1475. * Values:
  1476. * - 0 - Disable RDR interrupt
  1477. * - 1 - Enable RDR interrupt
  1478. */
  1479. //@{
  1480. #define BP_UART_UCR4_DREN (0) //!< Bit position for UART_UCR4_DREN.
  1481. #define BM_UART_UCR4_DREN (0x00000001) //!< Bit mask for UART_UCR4_DREN.
  1482. //! @brief Get value of UART_UCR4_DREN from a register value.
  1483. #define BG_UART_UCR4_DREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_DREN) >> BP_UART_UCR4_DREN)
  1484. //! @brief Format value for bitfield UART_UCR4_DREN.
  1485. #define BF_UART_UCR4_DREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_DREN) & BM_UART_UCR4_DREN)
  1486. #ifndef __LANGUAGE_ASM__
  1487. //! @brief Set the DREN field to a new value.
  1488. #define BW_UART_UCR4_DREN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_DREN) | BF_UART_UCR4_DREN(v)))
  1489. #endif
  1490. //@}
  1491. /*! @name Register UART_UCR4, field OREN[1] (RW)
  1492. *
  1493. * Receiver Overrun Interrupt Enable . Enables/Disables the ORE bit to generate an interrupt.
  1494. *
  1495. * Values:
  1496. * - 0 - Disable ORE interrupt
  1497. * - 1 - Enable ORE interrupt
  1498. */
  1499. //@{
  1500. #define BP_UART_UCR4_OREN (1) //!< Bit position for UART_UCR4_OREN.
  1501. #define BM_UART_UCR4_OREN (0x00000002) //!< Bit mask for UART_UCR4_OREN.
  1502. //! @brief Get value of UART_UCR4_OREN from a register value.
  1503. #define BG_UART_UCR4_OREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_OREN) >> BP_UART_UCR4_OREN)
  1504. //! @brief Format value for bitfield UART_UCR4_OREN.
  1505. #define BF_UART_UCR4_OREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_OREN) & BM_UART_UCR4_OREN)
  1506. #ifndef __LANGUAGE_ASM__
  1507. //! @brief Set the OREN field to a new value.
  1508. #define BW_UART_UCR4_OREN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_OREN) | BF_UART_UCR4_OREN(v)))
  1509. #endif
  1510. //@}
  1511. /*! @name Register UART_UCR4, field BKEN[2] (RW)
  1512. *
  1513. * BREAK Condition Detected Interrupt Enable . Enables/Disables the BRCD bit to generate an
  1514. * interrupt.
  1515. *
  1516. * Values:
  1517. * - 0 - Disable the BRCD interrupt
  1518. * - 1 - Enable the BRCD interrupt
  1519. */
  1520. //@{
  1521. #define BP_UART_UCR4_BKEN (2) //!< Bit position for UART_UCR4_BKEN.
  1522. #define BM_UART_UCR4_BKEN (0x00000004) //!< Bit mask for UART_UCR4_BKEN.
  1523. //! @brief Get value of UART_UCR4_BKEN from a register value.
  1524. #define BG_UART_UCR4_BKEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_BKEN) >> BP_UART_UCR4_BKEN)
  1525. //! @brief Format value for bitfield UART_UCR4_BKEN.
  1526. #define BF_UART_UCR4_BKEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_BKEN) & BM_UART_UCR4_BKEN)
  1527. #ifndef __LANGUAGE_ASM__
  1528. //! @brief Set the BKEN field to a new value.
  1529. #define BW_UART_UCR4_BKEN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_BKEN) | BF_UART_UCR4_BKEN(v)))
  1530. #endif
  1531. //@}
  1532. /*! @name Register UART_UCR4, field TCEN[3] (RW)
  1533. *
  1534. * Transmit Complete Interrupt Enable . Enables/Disables the TXDC bit to generate an interrupt (
  1535. * interrupt_uart = 0) An interrupt will be issued as long as TCEN and TXDC are high even if the
  1536. * transmitter is not enabled. In general, user should enable the transmitter before enabling the
  1537. * TXDC interrupt.
  1538. *
  1539. * Values:
  1540. * - 0 - Disable TXDC interrupt
  1541. * - 1 - Enable TXDC interrupt
  1542. */
  1543. //@{
  1544. #define BP_UART_UCR4_TCEN (3) //!< Bit position for UART_UCR4_TCEN.
  1545. #define BM_UART_UCR4_TCEN (0x00000008) //!< Bit mask for UART_UCR4_TCEN.
  1546. //! @brief Get value of UART_UCR4_TCEN from a register value.
  1547. #define BG_UART_UCR4_TCEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_TCEN) >> BP_UART_UCR4_TCEN)
  1548. //! @brief Format value for bitfield UART_UCR4_TCEN.
  1549. #define BF_UART_UCR4_TCEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_TCEN) & BM_UART_UCR4_TCEN)
  1550. #ifndef __LANGUAGE_ASM__
  1551. //! @brief Set the TCEN field to a new value.
  1552. #define BW_UART_UCR4_TCEN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_TCEN) | BF_UART_UCR4_TCEN(v)))
  1553. #endif
  1554. //@}
  1555. /*! @name Register UART_UCR4, field LPBYP[4] (RW)
  1556. *
  1557. * Low Power Bypass . Allows to bypass the low power new features in UART. To use during debug
  1558. * phase.
  1559. *
  1560. * Values:
  1561. * - 0 - Low power features enabled
  1562. * - 1 - Low power features disabled
  1563. */
  1564. //@{
  1565. #define BP_UART_UCR4_LPBYP (4) //!< Bit position for UART_UCR4_LPBYP.
  1566. #define BM_UART_UCR4_LPBYP (0x00000010) //!< Bit mask for UART_UCR4_LPBYP.
  1567. //! @brief Get value of UART_UCR4_LPBYP from a register value.
  1568. #define BG_UART_UCR4_LPBYP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_LPBYP) >> BP_UART_UCR4_LPBYP)
  1569. //! @brief Format value for bitfield UART_UCR4_LPBYP.
  1570. #define BF_UART_UCR4_LPBYP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_LPBYP) & BM_UART_UCR4_LPBYP)
  1571. #ifndef __LANGUAGE_ASM__
  1572. //! @brief Set the LPBYP field to a new value.
  1573. #define BW_UART_UCR4_LPBYP(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_LPBYP) | BF_UART_UCR4_LPBYP(v)))
  1574. #endif
  1575. //@}
  1576. /*! @name Register UART_UCR4, field IRSC[5] (RW)
  1577. *
  1578. * IR Special Case . Selects the clock for the vote logic. When set, IRSC switches the vote logic
  1579. * clock from the sampling clock to the UART reference clock. The IR pulses are counted a
  1580. * predetermined amount of time depending on the reference frequency. See .
  1581. *
  1582. * Values:
  1583. * - 0 - The vote logic uses the sampling clock (16x baud rate) for normal operation
  1584. * - 1 - The vote logic uses the UART reference clock
  1585. */
  1586. //@{
  1587. #define BP_UART_UCR4_IRSC (5) //!< Bit position for UART_UCR4_IRSC.
  1588. #define BM_UART_UCR4_IRSC (0x00000020) //!< Bit mask for UART_UCR4_IRSC.
  1589. //! @brief Get value of UART_UCR4_IRSC from a register value.
  1590. #define BG_UART_UCR4_IRSC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_IRSC) >> BP_UART_UCR4_IRSC)
  1591. //! @brief Format value for bitfield UART_UCR4_IRSC.
  1592. #define BF_UART_UCR4_IRSC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_IRSC) & BM_UART_UCR4_IRSC)
  1593. #ifndef __LANGUAGE_ASM__
  1594. //! @brief Set the IRSC field to a new value.
  1595. #define BW_UART_UCR4_IRSC(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_IRSC) | BF_UART_UCR4_IRSC(v)))
  1596. #endif
  1597. //@}
  1598. /*! @name Register UART_UCR4, field IDDMAEN[6] (RW)
  1599. *
  1600. * DMA IDLE Condition Detected Interrupt Enable Enables/Disables the receive DMA request dma_req_rx
  1601. * for the IDLE interrupt (triggered with IDLE flag in USR2[12]).
  1602. *
  1603. * Values:
  1604. * - 0 - DMA IDLE interrupt disabled
  1605. * - 1 - DMA IDLE interrupt enabled
  1606. */
  1607. //@{
  1608. #define BP_UART_UCR4_IDDMAEN (6) //!< Bit position for UART_UCR4_IDDMAEN.
  1609. #define BM_UART_UCR4_IDDMAEN (0x00000040) //!< Bit mask for UART_UCR4_IDDMAEN.
  1610. //! @brief Get value of UART_UCR4_IDDMAEN from a register value.
  1611. #define BG_UART_UCR4_IDDMAEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_IDDMAEN) >> BP_UART_UCR4_IDDMAEN)
  1612. //! @brief Format value for bitfield UART_UCR4_IDDMAEN.
  1613. #define BF_UART_UCR4_IDDMAEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_IDDMAEN) & BM_UART_UCR4_IDDMAEN)
  1614. #ifndef __LANGUAGE_ASM__
  1615. //! @brief Set the IDDMAEN field to a new value.
  1616. #define BW_UART_UCR4_IDDMAEN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_IDDMAEN) | BF_UART_UCR4_IDDMAEN(v)))
  1617. #endif
  1618. //@}
  1619. /*! @name Register UART_UCR4, field WKEN[7] (RW)
  1620. *
  1621. * WAKE Interrupt Enable . Enables/Disables the WAKE bit to generate an interrupt. The WAKE bit is
  1622. * set at the detection of a start bit by the receiver.
  1623. *
  1624. * Values:
  1625. * - 0 - Disable the WAKE interrupt
  1626. * - 1 - Enable the WAKE interrupt
  1627. */
  1628. //@{
  1629. #define BP_UART_UCR4_WKEN (7) //!< Bit position for UART_UCR4_WKEN.
  1630. #define BM_UART_UCR4_WKEN (0x00000080) //!< Bit mask for UART_UCR4_WKEN.
  1631. //! @brief Get value of UART_UCR4_WKEN from a register value.
  1632. #define BG_UART_UCR4_WKEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_WKEN) >> BP_UART_UCR4_WKEN)
  1633. //! @brief Format value for bitfield UART_UCR4_WKEN.
  1634. #define BF_UART_UCR4_WKEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_WKEN) & BM_UART_UCR4_WKEN)
  1635. #ifndef __LANGUAGE_ASM__
  1636. //! @brief Set the WKEN field to a new value.
  1637. #define BW_UART_UCR4_WKEN(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_WKEN) | BF_UART_UCR4_WKEN(v)))
  1638. #endif
  1639. //@}
  1640. /*! @name Register UART_UCR4, field ENIRI[8] (RW)
  1641. *
  1642. * Serial Infrared Interrupt Enable . Enables/Disables the serial infrared interrupt.
  1643. *
  1644. * Values:
  1645. * - 0 - Serial infrared Interrupt disabled
  1646. * - 1 - Serial infrared Interrupt enabled
  1647. */
  1648. //@{
  1649. #define BP_UART_UCR4_ENIRI (8) //!< Bit position for UART_UCR4_ENIRI.
  1650. #define BM_UART_UCR4_ENIRI (0x00000100) //!< Bit mask for UART_UCR4_ENIRI.
  1651. //! @brief Get value of UART_UCR4_ENIRI from a register value.
  1652. #define BG_UART_UCR4_ENIRI(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_ENIRI) >> BP_UART_UCR4_ENIRI)
  1653. //! @brief Format value for bitfield UART_UCR4_ENIRI.
  1654. #define BF_UART_UCR4_ENIRI(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_ENIRI) & BM_UART_UCR4_ENIRI)
  1655. #ifndef __LANGUAGE_ASM__
  1656. //! @brief Set the ENIRI field to a new value.
  1657. #define BW_UART_UCR4_ENIRI(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_ENIRI) | BF_UART_UCR4_ENIRI(v)))
  1658. #endif
  1659. //@}
  1660. /*! @name Register UART_UCR4, field INVR[9] (RW)
  1661. *
  1662. * Invert RXD input in RS-232/RS-485 Mode, d etermine RXD input logic level being sampled in In IrDA
  1663. * mode. In RS232/RS-485 Mode(UMCR[0] = 1), if this bit is set to 1, the RXD input is inverted
  1664. * before sampled. In IrDA mode ,when cleared, the infrared logic block expects an active low or
  1665. * negative IR 3/16 pulse for 0s and 1s are expected for 1s. When INVR is set (INVR 1), the infrared
  1666. * logic block expects an active high or positive IR 3/16 pulse for 0s and 0s are expected for 1s.
  1667. *
  1668. * Values:
  1669. * - 0 - RXD input is not inverted
  1670. * - 0 - RXD active low detection
  1671. * - 1 - RXD input is inverted
  1672. * - 1 - RXD active high detection
  1673. */
  1674. //@{
  1675. #define BP_UART_UCR4_INVR (9) //!< Bit position for UART_UCR4_INVR.
  1676. #define BM_UART_UCR4_INVR (0x00000200) //!< Bit mask for UART_UCR4_INVR.
  1677. //! @brief Get value of UART_UCR4_INVR from a register value.
  1678. #define BG_UART_UCR4_INVR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_INVR) >> BP_UART_UCR4_INVR)
  1679. //! @brief Format value for bitfield UART_UCR4_INVR.
  1680. #define BF_UART_UCR4_INVR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_INVR) & BM_UART_UCR4_INVR)
  1681. #ifndef __LANGUAGE_ASM__
  1682. //! @brief Set the INVR field to a new value.
  1683. #define BW_UART_UCR4_INVR(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_INVR) | BF_UART_UCR4_INVR(v)))
  1684. #endif
  1685. //@}
  1686. /*! @name Register UART_UCR4, field CTSTL[15:10] (RW)
  1687. *
  1688. * CTS Trigger Level . Controls the threshold at which the CTS pin is deasserted by the RxFIFO.
  1689. * After the trigger level is reached and the CTS pin is deasserted, the RxFIFO continues to receive
  1690. * data until it is full. The CTSTL bits are encoded as shown in the Settings column. Settings 0 to
  1691. * 32 are in use. All other settings are Reserved.
  1692. *
  1693. * Values:
  1694. * - 000000 - 0 characters received
  1695. * - ... -
  1696. * - ... -
  1697. * - 000001 - 1 characters in the RxFIFO
  1698. * - 100000 - 32 characters in the RxFIFO (maximum)
  1699. */
  1700. //@{
  1701. #define BP_UART_UCR4_CTSTL (10) //!< Bit position for UART_UCR4_CTSTL.
  1702. #define BM_UART_UCR4_CTSTL (0x0000fc00) //!< Bit mask for UART_UCR4_CTSTL.
  1703. //! @brief Get value of UART_UCR4_CTSTL from a register value.
  1704. #define BG_UART_UCR4_CTSTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UCR4_CTSTL) >> BP_UART_UCR4_CTSTL)
  1705. //! @brief Format value for bitfield UART_UCR4_CTSTL.
  1706. #define BF_UART_UCR4_CTSTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UCR4_CTSTL) & BM_UART_UCR4_CTSTL)
  1707. #ifndef __LANGUAGE_ASM__
  1708. //! @brief Set the CTSTL field to a new value.
  1709. #define BW_UART_UCR4_CTSTL(x, v) (HW_UART_UCR4_WR(x, (HW_UART_UCR4_RD(x) & ~BM_UART_UCR4_CTSTL) | BF_UART_UCR4_CTSTL(v)))
  1710. #endif
  1711. //@}
  1712. //-------------------------------------------------------------------------------------------
  1713. // HW_UART_UFCR - UART FIFO Control Register
  1714. //-------------------------------------------------------------------------------------------
  1715. #ifndef __LANGUAGE_ASM__
  1716. /*!
  1717. * @brief HW_UART_UFCR - UART FIFO Control Register (RW)
  1718. *
  1719. * Reset value: 0x00000801
  1720. */
  1721. typedef union _hw_uart_ufcr
  1722. {
  1723. reg32_t U;
  1724. struct _hw_uart_ufcr_bitfields
  1725. {
  1726. unsigned RXTL : 6; //!< [5:0] Receiver Trigger Level .
  1727. unsigned DCEDTE : 1; //!< [6] DCE/DTE mode select .
  1728. unsigned RFDIV : 3; //!< [9:7] Reference Frequency Divider.
  1729. unsigned TXTL : 6; //!< [15:10] Transmitter Trigger Level .
  1730. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  1731. } B;
  1732. } hw_uart_ufcr_t;
  1733. #endif
  1734. /*!
  1735. * @name Constants and macros for entire UART_UFCR register
  1736. */
  1737. //@{
  1738. #define HW_UART_UFCR_ADDR(x) (REGS_UART_BASE(x) + 0x90)
  1739. #ifndef __LANGUAGE_ASM__
  1740. #define HW_UART_UFCR(x) (*(volatile hw_uart_ufcr_t *) HW_UART_UFCR_ADDR(x))
  1741. #define HW_UART_UFCR_RD(x) (HW_UART_UFCR(x).U)
  1742. #define HW_UART_UFCR_WR(x, v) (HW_UART_UFCR(x).U = (v))
  1743. #define HW_UART_UFCR_SET(x, v) (HW_UART_UFCR_WR(x, HW_UART_UFCR_RD(x) | (v)))
  1744. #define HW_UART_UFCR_CLR(x, v) (HW_UART_UFCR_WR(x, HW_UART_UFCR_RD(x) & ~(v)))
  1745. #define HW_UART_UFCR_TOG(x, v) (HW_UART_UFCR_WR(x, HW_UART_UFCR_RD(x) ^ (v)))
  1746. #endif
  1747. //@}
  1748. /*
  1749. * constants & macros for individual UART_UFCR bitfields
  1750. */
  1751. /*! @name Register UART_UFCR, field RXTL[5:0] (RW)
  1752. *
  1753. * Receiver Trigger Level . Controls the threshold at which a maskable interrupt is generated by the
  1754. * RxFIFO. A maskable interrupt is generated whenever the data level in the RxFIFO reaches the
  1755. * selected threshold. The RXTL bits are encoded as shown in the Settings column. Setting 0 to 32
  1756. * are in use. All other settings are Reserved.
  1757. *
  1758. * Values:
  1759. * - 000000 - 0 characters received
  1760. * - ... -
  1761. * - ... -
  1762. * - 000001 - RxFIFO has 1 character
  1763. * - 011111 - RxFIFO has 31 characters
  1764. * - 100000 - RxFIFO has 32 characters (maximum)
  1765. */
  1766. //@{
  1767. #define BP_UART_UFCR_RXTL (0) //!< Bit position for UART_UFCR_RXTL.
  1768. #define BM_UART_UFCR_RXTL (0x0000003f) //!< Bit mask for UART_UFCR_RXTL.
  1769. //! @brief Get value of UART_UFCR_RXTL from a register value.
  1770. #define BG_UART_UFCR_RXTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UFCR_RXTL) >> BP_UART_UFCR_RXTL)
  1771. //! @brief Format value for bitfield UART_UFCR_RXTL.
  1772. #define BF_UART_UFCR_RXTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UFCR_RXTL) & BM_UART_UFCR_RXTL)
  1773. #ifndef __LANGUAGE_ASM__
  1774. //! @brief Set the RXTL field to a new value.
  1775. #define BW_UART_UFCR_RXTL(x, v) (HW_UART_UFCR_WR(x, (HW_UART_UFCR_RD(x) & ~BM_UART_UFCR_RXTL) | BF_UART_UFCR_RXTL(v)))
  1776. #endif
  1777. //@}
  1778. /*! @name Register UART_UFCR, field DCEDTE[6] (RW)
  1779. *
  1780. * DCE/DTE mode select . Select UART as data communication equipment (DCE mode) or as data terminal
  1781. * equipment (DTE mode).
  1782. *
  1783. * Values:
  1784. * - 0 - DCE mode selected
  1785. * - 1 - DTE mode selected
  1786. */
  1787. //@{
  1788. #define BP_UART_UFCR_DCEDTE (6) //!< Bit position for UART_UFCR_DCEDTE.
  1789. #define BM_UART_UFCR_DCEDTE (0x00000040) //!< Bit mask for UART_UFCR_DCEDTE.
  1790. //! @brief Get value of UART_UFCR_DCEDTE from a register value.
  1791. #define BG_UART_UFCR_DCEDTE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UFCR_DCEDTE) >> BP_UART_UFCR_DCEDTE)
  1792. //! @brief Format value for bitfield UART_UFCR_DCEDTE.
  1793. #define BF_UART_UFCR_DCEDTE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UFCR_DCEDTE) & BM_UART_UFCR_DCEDTE)
  1794. #ifndef __LANGUAGE_ASM__
  1795. //! @brief Set the DCEDTE field to a new value.
  1796. #define BW_UART_UFCR_DCEDTE(x, v) (HW_UART_UFCR_WR(x, (HW_UART_UFCR_RD(x) & ~BM_UART_UFCR_DCEDTE) | BF_UART_UFCR_DCEDTE(v)))
  1797. #endif
  1798. //@}
  1799. /*! @name Register UART_UFCR, field RFDIV[9:7] (RW)
  1800. *
  1801. * Reference Frequency Divider. Controls the divide ratio for the reference clock. The input clock
  1802. * is module_clock . The output from the divider is ref_clk which is used by BRM to create the 16x
  1803. * baud rate oversampling clock ( brm_clk ).
  1804. *
  1805. * Values:
  1806. * - 000 - Divide input clock by 6
  1807. * - 001 - Divide input clock by 5
  1808. * - 010 - Divide input clock by 4
  1809. * - 011 - Divide input clock by 3
  1810. * - 100 - Divide input clock by 2
  1811. * - 101 - Divide input clock by 1
  1812. * - 110 - Divide input clock by 7
  1813. * - 111 - Reserved
  1814. */
  1815. //@{
  1816. #define BP_UART_UFCR_RFDIV (7) //!< Bit position for UART_UFCR_RFDIV.
  1817. #define BM_UART_UFCR_RFDIV (0x00000380) //!< Bit mask for UART_UFCR_RFDIV.
  1818. //! @brief Get value of UART_UFCR_RFDIV from a register value.
  1819. #define BG_UART_UFCR_RFDIV(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UFCR_RFDIV) >> BP_UART_UFCR_RFDIV)
  1820. //! @brief Format value for bitfield UART_UFCR_RFDIV.
  1821. #define BF_UART_UFCR_RFDIV(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UFCR_RFDIV) & BM_UART_UFCR_RFDIV)
  1822. #ifndef __LANGUAGE_ASM__
  1823. //! @brief Set the RFDIV field to a new value.
  1824. #define BW_UART_UFCR_RFDIV(x, v) (HW_UART_UFCR_WR(x, (HW_UART_UFCR_RD(x) & ~BM_UART_UFCR_RFDIV) | BF_UART_UFCR_RFDIV(v)))
  1825. #endif
  1826. //@}
  1827. /*! @name Register UART_UFCR, field TXTL[15:10] (RW)
  1828. *
  1829. * Transmitter Trigger Level . Controls the threshold at which a maskable interrupt is generated by
  1830. * the TxFIFO. A maskable interrupt is generated whenever the data level in the TxFIFO falls below
  1831. * the selected threshold. The bits are encoded as shown in the Settings column. Settings 0 to 32
  1832. * are in use. All other settings are Reserved.
  1833. *
  1834. * Values:
  1835. * - 000000 - Reserved
  1836. * - ... -
  1837. * - ... -
  1838. * - 000001 - Reserved
  1839. * - 000010 - TxFIFO has 2 or fewer characters
  1840. * - 011111 - TxFIFO has 31 or fewer characters
  1841. * - 100000 - TxFIFO has 32 characters (maximum)
  1842. */
  1843. //@{
  1844. #define BP_UART_UFCR_TXTL (10) //!< Bit position for UART_UFCR_TXTL.
  1845. #define BM_UART_UFCR_TXTL (0x0000fc00) //!< Bit mask for UART_UFCR_TXTL.
  1846. //! @brief Get value of UART_UFCR_TXTL from a register value.
  1847. #define BG_UART_UFCR_TXTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UFCR_TXTL) >> BP_UART_UFCR_TXTL)
  1848. //! @brief Format value for bitfield UART_UFCR_TXTL.
  1849. #define BF_UART_UFCR_TXTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UFCR_TXTL) & BM_UART_UFCR_TXTL)
  1850. #ifndef __LANGUAGE_ASM__
  1851. //! @brief Set the TXTL field to a new value.
  1852. #define BW_UART_UFCR_TXTL(x, v) (HW_UART_UFCR_WR(x, (HW_UART_UFCR_RD(x) & ~BM_UART_UFCR_TXTL) | BF_UART_UFCR_TXTL(v)))
  1853. #endif
  1854. //@}
  1855. //-------------------------------------------------------------------------------------------
  1856. // HW_UART_USR1 - UART Status Register 1
  1857. //-------------------------------------------------------------------------------------------
  1858. #ifndef __LANGUAGE_ASM__
  1859. /*!
  1860. * @brief HW_UART_USR1 - UART Status Register 1 (RW)
  1861. *
  1862. * Reset value: 0x00002040
  1863. */
  1864. typedef union _hw_uart_usr1
  1865. {
  1866. reg32_t U;
  1867. struct _hw_uart_usr1_bitfields
  1868. {
  1869. unsigned RESERVED0 : 3; //!< [2:0] Reserved
  1870. unsigned SAD : 1; //!< [3] RS-485 Slave Address Detected Interrupt Flag.
  1871. unsigned AWAKE : 1; //!< [4] Asynchronous WAKE Interrupt Flag.
  1872. unsigned AIRINT : 1; //!< [5] Asynchronous IR WAKE Interrupt Flag.
  1873. unsigned RXDS : 1; //!< [6] Receiver IDLE Interrupt Flag.
  1874. unsigned DTRD : 1; //!< [7] DTR Delta.
  1875. unsigned AGTIM : 1; //!< [8] Ageing Timer Interrupt Flag.
  1876. unsigned RRDY : 1; //!< [9] Receiver Ready Interrupt / DMA Flag .
  1877. unsigned FRAMERR : 1; //!< [10] Frame Error Interrupt Flag .
  1878. unsigned ESCF : 1; //!< [11] Escape Sequence Interrupt Flag .
  1879. unsigned RTSD : 1; //!< [12] RTS Delta.
  1880. unsigned TRDY : 1; //!< [13] Transmitter Ready Interrupt / DMA Flag .
  1881. unsigned RTSS : 1; //!< [14] RTS Pin Status .
  1882. unsigned PARITYERR : 1; //!< [15] Parity Error Interrupt Flag .
  1883. unsigned RESERVED1 : 16; //!< [31:16] Reserved
  1884. } B;
  1885. } hw_uart_usr1_t;
  1886. #endif
  1887. /*!
  1888. * @name Constants and macros for entire UART_USR1 register
  1889. */
  1890. //@{
  1891. #define HW_UART_USR1_ADDR(x) (REGS_UART_BASE(x) + 0x94)
  1892. #ifndef __LANGUAGE_ASM__
  1893. #define HW_UART_USR1(x) (*(volatile hw_uart_usr1_t *) HW_UART_USR1_ADDR(x))
  1894. #define HW_UART_USR1_RD(x) (HW_UART_USR1(x).U)
  1895. #define HW_UART_USR1_WR(x, v) (HW_UART_USR1(x).U = (v))
  1896. #define HW_UART_USR1_SET(x, v) (HW_UART_USR1_WR(x, HW_UART_USR1_RD(x) | (v)))
  1897. #define HW_UART_USR1_CLR(x, v) (HW_UART_USR1_WR(x, HW_UART_USR1_RD(x) & ~(v)))
  1898. #define HW_UART_USR1_TOG(x, v) (HW_UART_USR1_WR(x, HW_UART_USR1_RD(x) ^ (v)))
  1899. #endif
  1900. //@}
  1901. /*
  1902. * constants & macros for individual UART_USR1 bitfields
  1903. */
  1904. /*! @name Register UART_USR1, field SAD[3] (W1C)
  1905. *
  1906. * RS-485 Slave Address Detected Interrupt Flag. Indicates if RS-485 Slave Address was detected .
  1907. * SAD was asserted in RS-485 mode when the SADEN bit is set and Slave Address is detected in RxFIFO
  1908. * (in Nomal Address Detect Mode, the 9 th data bit = 1; in Automatic Address Detect Mode, the
  1909. * received charater matches the programmed SLADDR).
  1910. *
  1911. * Values:
  1912. * - 0 - No slave address detected
  1913. * - 1 - Slave address detected
  1914. */
  1915. //@{
  1916. #define BP_UART_USR1_SAD (3) //!< Bit position for UART_USR1_SAD.
  1917. #define BM_UART_USR1_SAD (0x00000008) //!< Bit mask for UART_USR1_SAD.
  1918. //! @brief Get value of UART_USR1_SAD from a register value.
  1919. #define BG_UART_USR1_SAD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_SAD) >> BP_UART_USR1_SAD)
  1920. //! @brief Format value for bitfield UART_USR1_SAD.
  1921. #define BF_UART_USR1_SAD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_SAD) & BM_UART_USR1_SAD)
  1922. #ifndef __LANGUAGE_ASM__
  1923. //! @brief Set the SAD field to a new value.
  1924. #define BW_UART_USR1_SAD(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_SAD) | BF_UART_USR1_SAD(v)))
  1925. #endif
  1926. //@}
  1927. /*! @name Register UART_USR1, field AWAKE[4] (W1C)
  1928. *
  1929. * Asynchronous WAKE Interrupt Flag. Indicates that a falling edge was detected on the RXD pin.
  1930. * Clear AWAKE by writing 1 to it. Writing 0 to AWAKE has no effect.
  1931. *
  1932. * Values:
  1933. * - 0 - No falling edge was detected on the RXD Serial pin
  1934. * - 1 - A falling edge was detected on the RXD Serial pin
  1935. */
  1936. //@{
  1937. #define BP_UART_USR1_AWAKE (4) //!< Bit position for UART_USR1_AWAKE.
  1938. #define BM_UART_USR1_AWAKE (0x00000010) //!< Bit mask for UART_USR1_AWAKE.
  1939. //! @brief Get value of UART_USR1_AWAKE from a register value.
  1940. #define BG_UART_USR1_AWAKE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_AWAKE) >> BP_UART_USR1_AWAKE)
  1941. //! @brief Format value for bitfield UART_USR1_AWAKE.
  1942. #define BF_UART_USR1_AWAKE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_AWAKE) & BM_UART_USR1_AWAKE)
  1943. #ifndef __LANGUAGE_ASM__
  1944. //! @brief Set the AWAKE field to a new value.
  1945. #define BW_UART_USR1_AWAKE(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_AWAKE) | BF_UART_USR1_AWAKE(v)))
  1946. #endif
  1947. //@}
  1948. /*! @name Register UART_USR1, field AIRINT[5] (W1C)
  1949. *
  1950. * Asynchronous IR WAKE Interrupt Flag. Indicates that the IR WAKE pulse was detected on the RXD
  1951. * pin. Clear AIRINT by writing 1 to it. Writing 0 to AIRINT has no effect.
  1952. *
  1953. * Values:
  1954. * - 0 - No pulse was detected on the RXD IrDA pin
  1955. * - 1 - A pulse was detected on the RXD IrDA pin
  1956. */
  1957. //@{
  1958. #define BP_UART_USR1_AIRINT (5) //!< Bit position for UART_USR1_AIRINT.
  1959. #define BM_UART_USR1_AIRINT (0x00000020) //!< Bit mask for UART_USR1_AIRINT.
  1960. //! @brief Get value of UART_USR1_AIRINT from a register value.
  1961. #define BG_UART_USR1_AIRINT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_AIRINT) >> BP_UART_USR1_AIRINT)
  1962. //! @brief Format value for bitfield UART_USR1_AIRINT.
  1963. #define BF_UART_USR1_AIRINT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_AIRINT) & BM_UART_USR1_AIRINT)
  1964. #ifndef __LANGUAGE_ASM__
  1965. //! @brief Set the AIRINT field to a new value.
  1966. #define BW_UART_USR1_AIRINT(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_AIRINT) | BF_UART_USR1_AIRINT(v)))
  1967. #endif
  1968. //@}
  1969. /*! @name Register UART_USR1, field RXDS[6] (RO)
  1970. *
  1971. * Receiver IDLE Interrupt Flag. Indicates that the receiver state machine is in an IDLE state, the
  1972. * next state is IDLE, and the receive pin is high. RXDS is automatically cleared when a character
  1973. * is received. RXDS is active only when the receiver is enabled.
  1974. *
  1975. * Values:
  1976. * - 0 - Receive in progress
  1977. * - 1 - Receiver is IDLE
  1978. */
  1979. //@{
  1980. #define BP_UART_USR1_RXDS (6) //!< Bit position for UART_USR1_RXDS.
  1981. #define BM_UART_USR1_RXDS (0x00000040) //!< Bit mask for UART_USR1_RXDS.
  1982. //! @brief Get value of UART_USR1_RXDS from a register value.
  1983. #define BG_UART_USR1_RXDS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_RXDS) >> BP_UART_USR1_RXDS)
  1984. //@}
  1985. /*! @name Register UART_USR1, field DTRD[7] (W1C)
  1986. *
  1987. * DTR Delta. Indicates whether DTR (in DCE mode) or DSR (in DTE mode) pins changed state. DTRD
  1988. * generates a maskable interrupt if DTRDEN (UCR3[3]) is set. Clear DTRD by writing 1 to it. Writing
  1989. * 0 to DTRD has no effect.
  1990. *
  1991. * Values:
  1992. * - 0 - DTR (DCE) or DSR (DTE) pin did not change state since last cleared
  1993. * - 1 - DTR (DCE) or DSR (DTE) pin changed state (write 1 to clear)
  1994. */
  1995. //@{
  1996. #define BP_UART_USR1_DTRD (7) //!< Bit position for UART_USR1_DTRD.
  1997. #define BM_UART_USR1_DTRD (0x00000080) //!< Bit mask for UART_USR1_DTRD.
  1998. //! @brief Get value of UART_USR1_DTRD from a register value.
  1999. #define BG_UART_USR1_DTRD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_DTRD) >> BP_UART_USR1_DTRD)
  2000. //! @brief Format value for bitfield UART_USR1_DTRD.
  2001. #define BF_UART_USR1_DTRD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_DTRD) & BM_UART_USR1_DTRD)
  2002. #ifndef __LANGUAGE_ASM__
  2003. //! @brief Set the DTRD field to a new value.
  2004. #define BW_UART_USR1_DTRD(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_DTRD) | BF_UART_USR1_DTRD(v)))
  2005. #endif
  2006. //@}
  2007. /*! @name Register UART_USR1, field AGTIM[8] (W1C)
  2008. *
  2009. * Ageing Timer Interrupt Flag. Indicates that data in the RxFIFO has been idle for a time of 8
  2010. * character lengths (where a character length consists of 7 or 8 bits, depending on the setting of
  2011. * the WS bit in UCR2, with the bit time corresponding to the baud rate setting) and FIFO data level
  2012. * is less than RxFIFO threshold level (RXTL in the UFCR). Clear by writing a 1 to it.
  2013. *
  2014. * Values:
  2015. * - 0 - AGTIM is not active
  2016. * - 1 - AGTIM is active (write 1 to clear)
  2017. */
  2018. //@{
  2019. #define BP_UART_USR1_AGTIM (8) //!< Bit position for UART_USR1_AGTIM.
  2020. #define BM_UART_USR1_AGTIM (0x00000100) //!< Bit mask for UART_USR1_AGTIM.
  2021. //! @brief Get value of UART_USR1_AGTIM from a register value.
  2022. #define BG_UART_USR1_AGTIM(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_AGTIM) >> BP_UART_USR1_AGTIM)
  2023. //! @brief Format value for bitfield UART_USR1_AGTIM.
  2024. #define BF_UART_USR1_AGTIM(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_AGTIM) & BM_UART_USR1_AGTIM)
  2025. #ifndef __LANGUAGE_ASM__
  2026. //! @brief Set the AGTIM field to a new value.
  2027. #define BW_UART_USR1_AGTIM(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_AGTIM) | BF_UART_USR1_AGTIM(v)))
  2028. #endif
  2029. //@}
  2030. /*! @name Register UART_USR1, field RRDY[9] (RO)
  2031. *
  2032. * Receiver Ready Interrupt / DMA Flag . Indicates that the RxFIFO data level is above the threshold
  2033. * set by the RXTL bits. (See the RXTL bits description in for setting the interrupt threshold.)
  2034. * When asserted, RRDY generates a maskable interrupt or DMA request. RRDY is automatically cleared
  2035. * when data level in the RxFIFO goes below the set threshold level. At reset, RRDY is set to 0.
  2036. *
  2037. * Values:
  2038. * - 0 - No character ready
  2039. * - 1 - Character(s) ready (interrupt posted)
  2040. */
  2041. //@{
  2042. #define BP_UART_USR1_RRDY (9) //!< Bit position for UART_USR1_RRDY.
  2043. #define BM_UART_USR1_RRDY (0x00000200) //!< Bit mask for UART_USR1_RRDY.
  2044. //! @brief Get value of UART_USR1_RRDY from a register value.
  2045. #define BG_UART_USR1_RRDY(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_RRDY) >> BP_UART_USR1_RRDY)
  2046. //@}
  2047. /*! @name Register UART_USR1, field FRAMERR[10] (W1C)
  2048. *
  2049. * Frame Error Interrupt Flag . Indicates that a frame error is detected. The interrupt_uart
  2050. * interrupt will be generated if a frame error is detected and the interrupt is enabled. Clear
  2051. * FRAMERR by writing 1 to it. Writing 0 to FRAMERR has no effect.
  2052. *
  2053. * Values:
  2054. * - 0 - No frame error detected
  2055. * - 1 - Frame error detected (write 1 to clear)
  2056. */
  2057. //@{
  2058. #define BP_UART_USR1_FRAMERR (10) //!< Bit position for UART_USR1_FRAMERR.
  2059. #define BM_UART_USR1_FRAMERR (0x00000400) //!< Bit mask for UART_USR1_FRAMERR.
  2060. //! @brief Get value of UART_USR1_FRAMERR from a register value.
  2061. #define BG_UART_USR1_FRAMERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_FRAMERR) >> BP_UART_USR1_FRAMERR)
  2062. //! @brief Format value for bitfield UART_USR1_FRAMERR.
  2063. #define BF_UART_USR1_FRAMERR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_FRAMERR) & BM_UART_USR1_FRAMERR)
  2064. #ifndef __LANGUAGE_ASM__
  2065. //! @brief Set the FRAMERR field to a new value.
  2066. #define BW_UART_USR1_FRAMERR(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_FRAMERR) | BF_UART_USR1_FRAMERR(v)))
  2067. #endif
  2068. //@}
  2069. /*! @name Register UART_USR1, field ESCF[11] (W1C)
  2070. *
  2071. * Escape Sequence Interrupt Flag . Indicates if an escape sequence was detected. ESCF is asserted
  2072. * when the ESCEN bit is set and an escape sequence is detected in the RxFIFO. Clear ESCF by writing
  2073. * 1 to it. Writing 0 to ESCF has no effect.
  2074. *
  2075. * Values:
  2076. * - 0 - No escape sequence detected
  2077. * - 1 - Escape sequence detected (write 1 to clear).
  2078. */
  2079. //@{
  2080. #define BP_UART_USR1_ESCF (11) //!< Bit position for UART_USR1_ESCF.
  2081. #define BM_UART_USR1_ESCF (0x00000800) //!< Bit mask for UART_USR1_ESCF.
  2082. //! @brief Get value of UART_USR1_ESCF from a register value.
  2083. #define BG_UART_USR1_ESCF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_ESCF) >> BP_UART_USR1_ESCF)
  2084. //! @brief Format value for bitfield UART_USR1_ESCF.
  2085. #define BF_UART_USR1_ESCF(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_ESCF) & BM_UART_USR1_ESCF)
  2086. #ifndef __LANGUAGE_ASM__
  2087. //! @brief Set the ESCF field to a new value.
  2088. #define BW_UART_USR1_ESCF(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_ESCF) | BF_UART_USR1_ESCF(v)))
  2089. #endif
  2090. //@}
  2091. /*! @name Register UART_USR1, field RTSD[12] (W1C)
  2092. *
  2093. * RTS Delta. Indicates whether the RTS pin changed state. It (RTSD) generates a maskable interrupt.
  2094. * When in STOP mode, RTS assertion sets RTSD and can be used to wake the processor. The current
  2095. * state of the RTS pin is available on the RTSS bit. Clear RTSD by writing 1 to it. Writing 0 to
  2096. * RTSD has no effect. At reset, RTSD is set to 0.
  2097. *
  2098. * Values:
  2099. * - 0 - RTS pin did not change state since last cleared
  2100. * - 1 - RTS pin changed state (write 1 to clear)
  2101. */
  2102. //@{
  2103. #define BP_UART_USR1_RTSD (12) //!< Bit position for UART_USR1_RTSD.
  2104. #define BM_UART_USR1_RTSD (0x00001000) //!< Bit mask for UART_USR1_RTSD.
  2105. //! @brief Get value of UART_USR1_RTSD from a register value.
  2106. #define BG_UART_USR1_RTSD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_RTSD) >> BP_UART_USR1_RTSD)
  2107. //! @brief Format value for bitfield UART_USR1_RTSD.
  2108. #define BF_UART_USR1_RTSD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_RTSD) & BM_UART_USR1_RTSD)
  2109. #ifndef __LANGUAGE_ASM__
  2110. //! @brief Set the RTSD field to a new value.
  2111. #define BW_UART_USR1_RTSD(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_RTSD) | BF_UART_USR1_RTSD(v)))
  2112. #endif
  2113. //@}
  2114. /*! @name Register UART_USR1, field TRDY[13] (RO)
  2115. *
  2116. * Transmitter Ready Interrupt / DMA Flag . Indicates that the TxFIFO emptied below its target
  2117. * threshold and requires data. TRDY is automatically cleared when the data level in the TxFIFO
  2118. * exceeds the threshold set by TXTL bits. At reset, TRDY is set to 1.
  2119. *
  2120. * Values:
  2121. * - 0 - The transmitter does not require data
  2122. * - 1 - The transmitter requires data (interrupt posted)
  2123. */
  2124. //@{
  2125. #define BP_UART_USR1_TRDY (13) //!< Bit position for UART_USR1_TRDY.
  2126. #define BM_UART_USR1_TRDY (0x00002000) //!< Bit mask for UART_USR1_TRDY.
  2127. //! @brief Get value of UART_USR1_TRDY from a register value.
  2128. #define BG_UART_USR1_TRDY(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_TRDY) >> BP_UART_USR1_TRDY)
  2129. //@}
  2130. /*! @name Register UART_USR1, field RTSS[14] (RO)
  2131. *
  2132. * RTS Pin Status . Indicates the current status of the RTS pin. A "snapshot" of the pin is taken
  2133. * immediately before RTSS is presented to the data bus. RTSS cannot be cleared because all writes
  2134. * to RTSS are ignored. At reset, RTSS is set to 0.
  2135. *
  2136. * Values:
  2137. * - 0 - The RTS pin is high (inactive)
  2138. * - 1 - The RTS pin is low (active)
  2139. */
  2140. //@{
  2141. #define BP_UART_USR1_RTSS (14) //!< Bit position for UART_USR1_RTSS.
  2142. #define BM_UART_USR1_RTSS (0x00004000) //!< Bit mask for UART_USR1_RTSS.
  2143. //! @brief Get value of UART_USR1_RTSS from a register value.
  2144. #define BG_UART_USR1_RTSS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_RTSS) >> BP_UART_USR1_RTSS)
  2145. //@}
  2146. /*! @name Register UART_USR1, field PARITYERR[15] (W1C)
  2147. *
  2148. * Parity Error Interrupt Flag . Indicates a parity error is detected. PARITYERR is cleared by
  2149. * writing 1 to it. Writing 0 to PARITYERR has no effect. When parity is disabled, PARITYERR always
  2150. * reads 0. At reset, PARITYERR is set to 0.
  2151. *
  2152. * Values:
  2153. * - 0 - No parity error detected
  2154. * - 1 - Parity error detected (write 1 to clear)
  2155. */
  2156. //@{
  2157. #define BP_UART_USR1_PARITYERR (15) //!< Bit position for UART_USR1_PARITYERR.
  2158. #define BM_UART_USR1_PARITYERR (0x00008000) //!< Bit mask for UART_USR1_PARITYERR.
  2159. //! @brief Get value of UART_USR1_PARITYERR from a register value.
  2160. #define BG_UART_USR1_PARITYERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR1_PARITYERR) >> BP_UART_USR1_PARITYERR)
  2161. //! @brief Format value for bitfield UART_USR1_PARITYERR.
  2162. #define BF_UART_USR1_PARITYERR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR1_PARITYERR) & BM_UART_USR1_PARITYERR)
  2163. #ifndef __LANGUAGE_ASM__
  2164. //! @brief Set the PARITYERR field to a new value.
  2165. #define BW_UART_USR1_PARITYERR(x, v) (HW_UART_USR1_WR(x, (HW_UART_USR1_RD(x) & ~BM_UART_USR1_PARITYERR) | BF_UART_USR1_PARITYERR(v)))
  2166. #endif
  2167. //@}
  2168. //-------------------------------------------------------------------------------------------
  2169. // HW_UART_USR2 - UART Status Register 2
  2170. //-------------------------------------------------------------------------------------------
  2171. #ifndef __LANGUAGE_ASM__
  2172. /*!
  2173. * @brief HW_UART_USR2 - UART Status Register 2 (RW)
  2174. *
  2175. * Reset value: 0x00004028
  2176. */
  2177. typedef union _hw_uart_usr2
  2178. {
  2179. reg32_t U;
  2180. struct _hw_uart_usr2_bitfields
  2181. {
  2182. unsigned RDR : 1; //!< [0] Receive Data Ready -Indicates that at least 1 character is received and written to the RxFIFO.
  2183. unsigned ORE : 1; //!< [1] Overrun Error .
  2184. unsigned BRCD : 1; //!< [2] BREAK Condition Detected .
  2185. unsigned TXDC : 1; //!< [3] Transmitter Complete .
  2186. unsigned RTSF : 1; //!< [4] RTS Edge Triggered Interrupt Flag.
  2187. unsigned DCDIN : 1; //!< [5] Data Carrier Detect Input .
  2188. unsigned DCDDELT : 1; //!< [6] Data Carrier Detect Delta .
  2189. unsigned WAKE : 1; //!< [7] Wake .
  2190. unsigned IRINT : 1; //!< [8] Serial Infrared Interrupt Flag.
  2191. unsigned RIIN : 1; //!< [9] Ring Indicator Input .
  2192. unsigned RIDELT : 1; //!< [10] Ring Indicator Delta .
  2193. unsigned ACST : 1; //!< [11] Autobaud Counter Stopped .
  2194. unsigned IDLE : 1; //!< [12] Idle Condition .
  2195. unsigned DTRF : 1; //!< [13] DTR edge triggered interrupt flag .
  2196. unsigned TXFE : 1; //!< [14] Transmit Buffer FIFO Empty .
  2197. unsigned ADET : 1; //!< [15] Automatic Baud Rate Detect Complete .
  2198. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  2199. } B;
  2200. } hw_uart_usr2_t;
  2201. #endif
  2202. /*!
  2203. * @name Constants and macros for entire UART_USR2 register
  2204. */
  2205. //@{
  2206. #define HW_UART_USR2_ADDR(x) (REGS_UART_BASE(x) + 0x98)
  2207. #ifndef __LANGUAGE_ASM__
  2208. #define HW_UART_USR2(x) (*(volatile hw_uart_usr2_t *) HW_UART_USR2_ADDR(x))
  2209. #define HW_UART_USR2_RD(x) (HW_UART_USR2(x).U)
  2210. #define HW_UART_USR2_WR(x, v) (HW_UART_USR2(x).U = (v))
  2211. #define HW_UART_USR2_SET(x, v) (HW_UART_USR2_WR(x, HW_UART_USR2_RD(x) | (v)))
  2212. #define HW_UART_USR2_CLR(x, v) (HW_UART_USR2_WR(x, HW_UART_USR2_RD(x) & ~(v)))
  2213. #define HW_UART_USR2_TOG(x, v) (HW_UART_USR2_WR(x, HW_UART_USR2_RD(x) ^ (v)))
  2214. #endif
  2215. //@}
  2216. /*
  2217. * constants & macros for individual UART_USR2 bitfields
  2218. */
  2219. /*! @name Register UART_USR2, field RDR[0] (RO)
  2220. *
  2221. * Receive Data Ready -Indicates that at least 1 character is received and written to the RxFIFO. If
  2222. * the URXD register is read and there is only 1 character in the RxFIFO, RDR is automatically
  2223. * cleared.
  2224. *
  2225. * Values:
  2226. * - 0 - No receive data ready
  2227. * - 1 - Receive data ready
  2228. */
  2229. //@{
  2230. #define BP_UART_USR2_RDR (0) //!< Bit position for UART_USR2_RDR.
  2231. #define BM_UART_USR2_RDR (0x00000001) //!< Bit mask for UART_USR2_RDR.
  2232. //! @brief Get value of UART_USR2_RDR from a register value.
  2233. #define BG_UART_USR2_RDR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_RDR) >> BP_UART_USR2_RDR)
  2234. //@}
  2235. /*! @name Register UART_USR2, field ORE[1] (W1C)
  2236. *
  2237. * Overrun Error . When set to 1, ORE indicates that the receive buffer (RxFIFO) was full (32 chars
  2238. * inside), and a 33rd character has been fully received. This 33rd character has been discarded.
  2239. * Clear ORE by writing 1 to it. Writing 0 to ORE has no effect.
  2240. *
  2241. * Values:
  2242. * - 0 - No overrun error
  2243. * - 1 - Overrun error (write 1 to clear)
  2244. */
  2245. //@{
  2246. #define BP_UART_USR2_ORE (1) //!< Bit position for UART_USR2_ORE.
  2247. #define BM_UART_USR2_ORE (0x00000002) //!< Bit mask for UART_USR2_ORE.
  2248. //! @brief Get value of UART_USR2_ORE from a register value.
  2249. #define BG_UART_USR2_ORE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_ORE) >> BP_UART_USR2_ORE)
  2250. //! @brief Format value for bitfield UART_USR2_ORE.
  2251. #define BF_UART_USR2_ORE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_ORE) & BM_UART_USR2_ORE)
  2252. #ifndef __LANGUAGE_ASM__
  2253. //! @brief Set the ORE field to a new value.
  2254. #define BW_UART_USR2_ORE(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_ORE) | BF_UART_USR2_ORE(v)))
  2255. #endif
  2256. //@}
  2257. /*! @name Register UART_USR2, field BRCD[2] (W1C)
  2258. *
  2259. * BREAK Condition Detected . Indicates that a BREAK condition was detected by the receiver. Clear
  2260. * BRCD by writing 1 to it. Writing 0 to BRCD has no effect.
  2261. *
  2262. * Values:
  2263. * - 0 - No BREAK condition was detected
  2264. * - 1 - A BREAK condition was detected (write 1 to clear)
  2265. */
  2266. //@{
  2267. #define BP_UART_USR2_BRCD (2) //!< Bit position for UART_USR2_BRCD.
  2268. #define BM_UART_USR2_BRCD (0x00000004) //!< Bit mask for UART_USR2_BRCD.
  2269. //! @brief Get value of UART_USR2_BRCD from a register value.
  2270. #define BG_UART_USR2_BRCD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_BRCD) >> BP_UART_USR2_BRCD)
  2271. //! @brief Format value for bitfield UART_USR2_BRCD.
  2272. #define BF_UART_USR2_BRCD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_BRCD) & BM_UART_USR2_BRCD)
  2273. #ifndef __LANGUAGE_ASM__
  2274. //! @brief Set the BRCD field to a new value.
  2275. #define BW_UART_USR2_BRCD(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_BRCD) | BF_UART_USR2_BRCD(v)))
  2276. #endif
  2277. //@}
  2278. /*! @name Register UART_USR2, field TXDC[3] (RO)
  2279. *
  2280. * Transmitter Complete . Indicates that the transmit buffer (TxFIFO) and Shift Register is empty;
  2281. * therefore the transmission is complete. TXDC is cleared automatically when data is written to the
  2282. * TxFIFO.
  2283. *
  2284. * Values:
  2285. * - 0 - Transmit is incomplete
  2286. * - 1 - Transmit is complete
  2287. */
  2288. //@{
  2289. #define BP_UART_USR2_TXDC (3) //!< Bit position for UART_USR2_TXDC.
  2290. #define BM_UART_USR2_TXDC (0x00000008) //!< Bit mask for UART_USR2_TXDC.
  2291. //! @brief Get value of UART_USR2_TXDC from a register value.
  2292. #define BG_UART_USR2_TXDC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_TXDC) >> BP_UART_USR2_TXDC)
  2293. //@}
  2294. /*! @name Register UART_USR2, field RTSF[4] (W1C)
  2295. *
  2296. * RTS Edge Triggered Interrupt Flag. Indicates if a programmed edge is detected on the RTS pin. The
  2297. * RTEC bits select the edge that generates an interrupt (see ). RTSF can generate an interrupt that
  2298. * can be masked using the RTSEN bit. Clear RTSF by writing 1 to it. Writing 0 to RTSF has no
  2299. * effect.
  2300. *
  2301. * Values:
  2302. * - 0 - Programmed edge not detected on RTS
  2303. * - 1 - Programmed edge detected on RTS (write 1 to clear)
  2304. */
  2305. //@{
  2306. #define BP_UART_USR2_RTSF (4) //!< Bit position for UART_USR2_RTSF.
  2307. #define BM_UART_USR2_RTSF (0x00000010) //!< Bit mask for UART_USR2_RTSF.
  2308. //! @brief Get value of UART_USR2_RTSF from a register value.
  2309. #define BG_UART_USR2_RTSF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_RTSF) >> BP_UART_USR2_RTSF)
  2310. //! @brief Format value for bitfield UART_USR2_RTSF.
  2311. #define BF_UART_USR2_RTSF(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_RTSF) & BM_UART_USR2_RTSF)
  2312. #ifndef __LANGUAGE_ASM__
  2313. //! @brief Set the RTSF field to a new value.
  2314. #define BW_UART_USR2_RTSF(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_RTSF) | BF_UART_USR2_RTSF(v)))
  2315. #endif
  2316. //@}
  2317. /*! @name Register UART_USR2, field DCDIN[5] (RO)
  2318. *
  2319. * Data Carrier Detect Input . This bit is used in DTE mode reflect the status of the Data Carrier
  2320. * Detect input ( DCD ). The Data Carrier Detect input is used to indicate that a carrier signal has
  2321. * been detected. In DCE mode this bit is always zero.
  2322. *
  2323. * Values:
  2324. * - 0 - Carrier signal Detected
  2325. * - 1 - No Carrier signal Detected
  2326. */
  2327. //@{
  2328. #define BP_UART_USR2_DCDIN (5) //!< Bit position for UART_USR2_DCDIN.
  2329. #define BM_UART_USR2_DCDIN (0x00000020) //!< Bit mask for UART_USR2_DCDIN.
  2330. //! @brief Get value of UART_USR2_DCDIN from a register value.
  2331. #define BG_UART_USR2_DCDIN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_DCDIN) >> BP_UART_USR2_DCDIN)
  2332. //@}
  2333. /*! @name Register UART_USR2, field DCDDELT[6] (W1C)
  2334. *
  2335. * Data Carrier Detect Delta . This bit is used in DTE mode to indicate that the Data Carrier Detect
  2336. * input ( DCD ) has changed state. This flag can cause an interrupt if DCD (UCR3[9]) is enabled.
  2337. * When in STOP mode, this bit can be used to wake the processor. In DCE mode this bit is always
  2338. * zero.
  2339. *
  2340. * Values:
  2341. * - 0 - Data Carrier Detect input has not changed state
  2342. * - 1 - Data Carrier Detect input has changed state (write 1 to clear)
  2343. */
  2344. //@{
  2345. #define BP_UART_USR2_DCDDELT (6) //!< Bit position for UART_USR2_DCDDELT.
  2346. #define BM_UART_USR2_DCDDELT (0x00000040) //!< Bit mask for UART_USR2_DCDDELT.
  2347. //! @brief Get value of UART_USR2_DCDDELT from a register value.
  2348. #define BG_UART_USR2_DCDDELT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_DCDDELT) >> BP_UART_USR2_DCDDELT)
  2349. //! @brief Format value for bitfield UART_USR2_DCDDELT.
  2350. #define BF_UART_USR2_DCDDELT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_DCDDELT) & BM_UART_USR2_DCDDELT)
  2351. #ifndef __LANGUAGE_ASM__
  2352. //! @brief Set the DCDDELT field to a new value.
  2353. #define BW_UART_USR2_DCDDELT(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_DCDDELT) | BF_UART_USR2_DCDDELT(v)))
  2354. #endif
  2355. //@}
  2356. /*! @name Register UART_USR2, field WAKE[7] (W1C)
  2357. *
  2358. * Wake . Indicates the start bit is detected. WAKE can generate an interrupt that can be masked
  2359. * using the WKEN bit. Clear WAKE by writing 1 to it. Writing 0 to WAKE has no effect.
  2360. *
  2361. * Values:
  2362. * - 0 - start bit not detected
  2363. * - 1 - start bit detected (write 1 to clear)
  2364. */
  2365. //@{
  2366. #define BP_UART_USR2_WAKE (7) //!< Bit position for UART_USR2_WAKE.
  2367. #define BM_UART_USR2_WAKE (0x00000080) //!< Bit mask for UART_USR2_WAKE.
  2368. //! @brief Get value of UART_USR2_WAKE from a register value.
  2369. #define BG_UART_USR2_WAKE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_WAKE) >> BP_UART_USR2_WAKE)
  2370. //! @brief Format value for bitfield UART_USR2_WAKE.
  2371. #define BF_UART_USR2_WAKE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_WAKE) & BM_UART_USR2_WAKE)
  2372. #ifndef __LANGUAGE_ASM__
  2373. //! @brief Set the WAKE field to a new value.
  2374. #define BW_UART_USR2_WAKE(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_WAKE) | BF_UART_USR2_WAKE(v)))
  2375. #endif
  2376. //@}
  2377. /*! @name Register UART_USR2, field IRINT[8] (W1C)
  2378. *
  2379. * Serial Infrared Interrupt Flag. When an edge is detected on the RXD pin during SIR Mode, this
  2380. * flag will be asserted. This flag can cause an interrupt which can be masked using the control bit
  2381. * ENIRI: UCR4 [8].
  2382. *
  2383. * Values:
  2384. * - 0 - no edge detected
  2385. * - 1 - valid edge detected (write 1 to clear)
  2386. */
  2387. //@{
  2388. #define BP_UART_USR2_IRINT (8) //!< Bit position for UART_USR2_IRINT.
  2389. #define BM_UART_USR2_IRINT (0x00000100) //!< Bit mask for UART_USR2_IRINT.
  2390. //! @brief Get value of UART_USR2_IRINT from a register value.
  2391. #define BG_UART_USR2_IRINT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_IRINT) >> BP_UART_USR2_IRINT)
  2392. //! @brief Format value for bitfield UART_USR2_IRINT.
  2393. #define BF_UART_USR2_IRINT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_IRINT) & BM_UART_USR2_IRINT)
  2394. #ifndef __LANGUAGE_ASM__
  2395. //! @brief Set the IRINT field to a new value.
  2396. #define BW_UART_USR2_IRINT(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_IRINT) | BF_UART_USR2_IRINT(v)))
  2397. #endif
  2398. //@}
  2399. /*! @name Register UART_USR2, field RIIN[9] (RO)
  2400. *
  2401. * Ring Indicator Input . This bit is used in DTE mode to reflect the status if the Ring Indicator
  2402. * input ( RI ). The Ring Indicator input is used to indicate that a ring has occurred. In DCE mode
  2403. * this bit is always zero.
  2404. *
  2405. * Values:
  2406. * - 0 - Ring Detected
  2407. * - 1 - No Ring Detected
  2408. */
  2409. //@{
  2410. #define BP_UART_USR2_RIIN (9) //!< Bit position for UART_USR2_RIIN.
  2411. #define BM_UART_USR2_RIIN (0x00000200) //!< Bit mask for UART_USR2_RIIN.
  2412. //! @brief Get value of UART_USR2_RIIN from a register value.
  2413. #define BG_UART_USR2_RIIN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_RIIN) >> BP_UART_USR2_RIIN)
  2414. //@}
  2415. /*! @name Register UART_USR2, field RIDELT[10] (W1C)
  2416. *
  2417. * Ring Indicator Delta . This bit is used in DTE mode to indicate that the Ring Indicator input (
  2418. * RI ) has changed state. This flag can generate an interrupt if RI (UCR3[8]) is enabled. RIDELT is
  2419. * cleared by writing 1 to it. Writing 0 to RIDELT has no effect.
  2420. *
  2421. * Values:
  2422. * - 0 - Ring Indicator input has not changed state
  2423. * - 1 - Ring Indicator input has changed state (write 1 to clear)
  2424. */
  2425. //@{
  2426. #define BP_UART_USR2_RIDELT (10) //!< Bit position for UART_USR2_RIDELT.
  2427. #define BM_UART_USR2_RIDELT (0x00000400) //!< Bit mask for UART_USR2_RIDELT.
  2428. //! @brief Get value of UART_USR2_RIDELT from a register value.
  2429. #define BG_UART_USR2_RIDELT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_RIDELT) >> BP_UART_USR2_RIDELT)
  2430. //! @brief Format value for bitfield UART_USR2_RIDELT.
  2431. #define BF_UART_USR2_RIDELT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_RIDELT) & BM_UART_USR2_RIDELT)
  2432. #ifndef __LANGUAGE_ASM__
  2433. //! @brief Set the RIDELT field to a new value.
  2434. #define BW_UART_USR2_RIDELT(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_RIDELT) | BF_UART_USR2_RIDELT(v)))
  2435. #endif
  2436. //@}
  2437. /*! @name Register UART_USR2, field ACST[11] (W1C)
  2438. *
  2439. * Autobaud Counter Stopped . In autobaud detection (ADBR=1), indicates the counter which determines
  2440. * the baud rate was running and is now stopped. This means either START bit is finished (if
  2441. * ADNIMP=1), or Bit 0 is finished (if ADNIMP=0). See , for more details. An interrupt can be
  2442. * flagged on interrupt_uart if ACIEN=1.
  2443. *
  2444. * Values:
  2445. * - 0 - Measurement of bit length not finished (in autobaud)
  2446. * - 1 - Measurement of bit length finished (in autobaud). (write 1 to clear)
  2447. */
  2448. //@{
  2449. #define BP_UART_USR2_ACST (11) //!< Bit position for UART_USR2_ACST.
  2450. #define BM_UART_USR2_ACST (0x00000800) //!< Bit mask for UART_USR2_ACST.
  2451. //! @brief Get value of UART_USR2_ACST from a register value.
  2452. #define BG_UART_USR2_ACST(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_ACST) >> BP_UART_USR2_ACST)
  2453. //! @brief Format value for bitfield UART_USR2_ACST.
  2454. #define BF_UART_USR2_ACST(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_ACST) & BM_UART_USR2_ACST)
  2455. #ifndef __LANGUAGE_ASM__
  2456. //! @brief Set the ACST field to a new value.
  2457. #define BW_UART_USR2_ACST(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_ACST) | BF_UART_USR2_ACST(v)))
  2458. #endif
  2459. //@}
  2460. /*! @name Register UART_USR2, field IDLE[12] (W1C)
  2461. *
  2462. * Idle Condition . Indicates that an idle condition has existed for more than a programmed amount
  2463. * frame (see . An interrupt can be generated by this IDLE bit if IDEN (UCR1[12]) is enabled. IDLE
  2464. * is cleared by writing 1 to it. Writing 0 to IDLE has no effect.
  2465. *
  2466. * Values:
  2467. * - 0 - No idle condition detected
  2468. * - 1 - Idle condition detected (write 1 to clear)
  2469. */
  2470. //@{
  2471. #define BP_UART_USR2_IDLE (12) //!< Bit position for UART_USR2_IDLE.
  2472. #define BM_UART_USR2_IDLE (0x00001000) //!< Bit mask for UART_USR2_IDLE.
  2473. //! @brief Get value of UART_USR2_IDLE from a register value.
  2474. #define BG_UART_USR2_IDLE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_IDLE) >> BP_UART_USR2_IDLE)
  2475. //! @brief Format value for bitfield UART_USR2_IDLE.
  2476. #define BF_UART_USR2_IDLE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_IDLE) & BM_UART_USR2_IDLE)
  2477. #ifndef __LANGUAGE_ASM__
  2478. //! @brief Set the IDLE field to a new value.
  2479. #define BW_UART_USR2_IDLE(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_IDLE) | BF_UART_USR2_IDLE(v)))
  2480. #endif
  2481. //@}
  2482. /*! @name Register UART_USR2, field DTRF[13] (W1C)
  2483. *
  2484. * DTR edge triggered interrupt flag . This bit is asserted, when the programmed edge is detected on
  2485. * the DTR pin (DCE mode) or on DSR (DTE mode). This flag can cause an interrupt if DTREN (UCR3[13])
  2486. * is enabled.
  2487. *
  2488. * Values:
  2489. * - 0 - Programmed edge not detected on DTR/DSR
  2490. * - 1 - Programmed edge detected on DTR/DSR (write 1 to clear)
  2491. */
  2492. //@{
  2493. #define BP_UART_USR2_DTRF (13) //!< Bit position for UART_USR2_DTRF.
  2494. #define BM_UART_USR2_DTRF (0x00002000) //!< Bit mask for UART_USR2_DTRF.
  2495. //! @brief Get value of UART_USR2_DTRF from a register value.
  2496. #define BG_UART_USR2_DTRF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_DTRF) >> BP_UART_USR2_DTRF)
  2497. //! @brief Format value for bitfield UART_USR2_DTRF.
  2498. #define BF_UART_USR2_DTRF(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_DTRF) & BM_UART_USR2_DTRF)
  2499. #ifndef __LANGUAGE_ASM__
  2500. //! @brief Set the DTRF field to a new value.
  2501. #define BW_UART_USR2_DTRF(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_DTRF) | BF_UART_USR2_DTRF(v)))
  2502. #endif
  2503. //@}
  2504. /*! @name Register UART_USR2, field TXFE[14] (RO)
  2505. *
  2506. * Transmit Buffer FIFO Empty . Indicates that the transmit buffer (TxFIFO) is empty. TXFE is
  2507. * cleared automatically when data is written to the TxFIFO. Even though TXFE is high, the
  2508. * transmission might still be in progress.
  2509. *
  2510. * Values:
  2511. * - 0 - The transmit buffer (TxFIFO) is not empty
  2512. * - 1 - The transmit buffer (TxFIFO) is empty
  2513. */
  2514. //@{
  2515. #define BP_UART_USR2_TXFE (14) //!< Bit position for UART_USR2_TXFE.
  2516. #define BM_UART_USR2_TXFE (0x00004000) //!< Bit mask for UART_USR2_TXFE.
  2517. //! @brief Get value of UART_USR2_TXFE from a register value.
  2518. #define BG_UART_USR2_TXFE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_TXFE) >> BP_UART_USR2_TXFE)
  2519. //@}
  2520. /*! @name Register UART_USR2, field ADET[15] (W1C)
  2521. *
  2522. * Automatic Baud Rate Detect Complete . Indicates that an "A" or "a" was received and that the
  2523. * receiver detected and verified the incoming baud rate. Clear ADET by writing 1 to it. Writing 0
  2524. * to ADET has no effect.
  2525. *
  2526. * Values:
  2527. * - 0 - ASCII "A" or "a" was not received
  2528. * - 1 - ASCII "A" or "a" was received (write 1 to clear)
  2529. */
  2530. //@{
  2531. #define BP_UART_USR2_ADET (15) //!< Bit position for UART_USR2_ADET.
  2532. #define BM_UART_USR2_ADET (0x00008000) //!< Bit mask for UART_USR2_ADET.
  2533. //! @brief Get value of UART_USR2_ADET from a register value.
  2534. #define BG_UART_USR2_ADET(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_USR2_ADET) >> BP_UART_USR2_ADET)
  2535. //! @brief Format value for bitfield UART_USR2_ADET.
  2536. #define BF_UART_USR2_ADET(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_USR2_ADET) & BM_UART_USR2_ADET)
  2537. #ifndef __LANGUAGE_ASM__
  2538. //! @brief Set the ADET field to a new value.
  2539. #define BW_UART_USR2_ADET(x, v) (HW_UART_USR2_WR(x, (HW_UART_USR2_RD(x) & ~BM_UART_USR2_ADET) | BF_UART_USR2_ADET(v)))
  2540. #endif
  2541. //@}
  2542. //-------------------------------------------------------------------------------------------
  2543. // HW_UART_UESC - UART Escape Character Register
  2544. //-------------------------------------------------------------------------------------------
  2545. #ifndef __LANGUAGE_ASM__
  2546. /*!
  2547. * @brief HW_UART_UESC - UART Escape Character Register (RW)
  2548. *
  2549. * Reset value: 0x0000002b
  2550. */
  2551. typedef union _hw_uart_uesc
  2552. {
  2553. reg32_t U;
  2554. struct _hw_uart_uesc_bitfields
  2555. {
  2556. unsigned ESC_CHAR : 8; //!< [7:0] UART Escape Character .
  2557. unsigned RESERVED0 : 24; //!< [31:8] Reserved
  2558. } B;
  2559. } hw_uart_uesc_t;
  2560. #endif
  2561. /*!
  2562. * @name Constants and macros for entire UART_UESC register
  2563. */
  2564. //@{
  2565. #define HW_UART_UESC_ADDR(x) (REGS_UART_BASE(x) + 0x9c)
  2566. #ifndef __LANGUAGE_ASM__
  2567. #define HW_UART_UESC(x) (*(volatile hw_uart_uesc_t *) HW_UART_UESC_ADDR(x))
  2568. #define HW_UART_UESC_RD(x) (HW_UART_UESC(x).U)
  2569. #define HW_UART_UESC_WR(x, v) (HW_UART_UESC(x).U = (v))
  2570. #define HW_UART_UESC_SET(x, v) (HW_UART_UESC_WR(x, HW_UART_UESC_RD(x) | (v)))
  2571. #define HW_UART_UESC_CLR(x, v) (HW_UART_UESC_WR(x, HW_UART_UESC_RD(x) & ~(v)))
  2572. #define HW_UART_UESC_TOG(x, v) (HW_UART_UESC_WR(x, HW_UART_UESC_RD(x) ^ (v)))
  2573. #endif
  2574. //@}
  2575. /*
  2576. * constants & macros for individual UART_UESC bitfields
  2577. */
  2578. /*! @name Register UART_UESC, field ESC_CHAR[7:0] (RW)
  2579. *
  2580. * UART Escape Character . Holds the selected escape character that all received characters are
  2581. * compared against to detect an escape sequence.
  2582. */
  2583. //@{
  2584. #define BP_UART_UESC_ESC_CHAR (0) //!< Bit position for UART_UESC_ESC_CHAR.
  2585. #define BM_UART_UESC_ESC_CHAR (0x000000ff) //!< Bit mask for UART_UESC_ESC_CHAR.
  2586. //! @brief Get value of UART_UESC_ESC_CHAR from a register value.
  2587. #define BG_UART_UESC_ESC_CHAR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UESC_ESC_CHAR) >> BP_UART_UESC_ESC_CHAR)
  2588. //! @brief Format value for bitfield UART_UESC_ESC_CHAR.
  2589. #define BF_UART_UESC_ESC_CHAR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UESC_ESC_CHAR) & BM_UART_UESC_ESC_CHAR)
  2590. #ifndef __LANGUAGE_ASM__
  2591. //! @brief Set the ESC_CHAR field to a new value.
  2592. #define BW_UART_UESC_ESC_CHAR(x, v) (HW_UART_UESC_WR(x, (HW_UART_UESC_RD(x) & ~BM_UART_UESC_ESC_CHAR) | BF_UART_UESC_ESC_CHAR(v)))
  2593. #endif
  2594. //@}
  2595. //-------------------------------------------------------------------------------------------
  2596. // HW_UART_UTIM - UART Escape Timer Register
  2597. //-------------------------------------------------------------------------------------------
  2598. #ifndef __LANGUAGE_ASM__
  2599. /*!
  2600. * @brief HW_UART_UTIM - UART Escape Timer Register (RW)
  2601. *
  2602. * Reset value: 0x00000000
  2603. */
  2604. typedef union _hw_uart_utim
  2605. {
  2606. reg32_t U;
  2607. struct _hw_uart_utim_bitfields
  2608. {
  2609. unsigned TIM : 12; //!< [11:0] UART Escape Timer.
  2610. unsigned RESERVED0 : 20; //!< [31:12] Reserved
  2611. } B;
  2612. } hw_uart_utim_t;
  2613. #endif
  2614. /*!
  2615. * @name Constants and macros for entire UART_UTIM register
  2616. */
  2617. //@{
  2618. #define HW_UART_UTIM_ADDR(x) (REGS_UART_BASE(x) + 0xa0)
  2619. #ifndef __LANGUAGE_ASM__
  2620. #define HW_UART_UTIM(x) (*(volatile hw_uart_utim_t *) HW_UART_UTIM_ADDR(x))
  2621. #define HW_UART_UTIM_RD(x) (HW_UART_UTIM(x).U)
  2622. #define HW_UART_UTIM_WR(x, v) (HW_UART_UTIM(x).U = (v))
  2623. #define HW_UART_UTIM_SET(x, v) (HW_UART_UTIM_WR(x, HW_UART_UTIM_RD(x) | (v)))
  2624. #define HW_UART_UTIM_CLR(x, v) (HW_UART_UTIM_WR(x, HW_UART_UTIM_RD(x) & ~(v)))
  2625. #define HW_UART_UTIM_TOG(x, v) (HW_UART_UTIM_WR(x, HW_UART_UTIM_RD(x) ^ (v)))
  2626. #endif
  2627. //@}
  2628. /*
  2629. * constants & macros for individual UART_UTIM bitfields
  2630. */
  2631. /*! @name Register UART_UTIM, field TIM[11:0] (RW)
  2632. *
  2633. * UART Escape Timer. Holds the maximum time interval (in ms) allowed between escape characters. The
  2634. * escape timer register is programmable in intervals of 2 ms. See and for more information on the
  2635. * UART escape sequence detection. Reset value 0x000 = 2 ms up to 0xFFF = 8.192 s.
  2636. */
  2637. //@{
  2638. #define BP_UART_UTIM_TIM (0) //!< Bit position for UART_UTIM_TIM.
  2639. #define BM_UART_UTIM_TIM (0x00000fff) //!< Bit mask for UART_UTIM_TIM.
  2640. //! @brief Get value of UART_UTIM_TIM from a register value.
  2641. #define BG_UART_UTIM_TIM(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTIM_TIM) >> BP_UART_UTIM_TIM)
  2642. //! @brief Format value for bitfield UART_UTIM_TIM.
  2643. #define BF_UART_UTIM_TIM(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTIM_TIM) & BM_UART_UTIM_TIM)
  2644. #ifndef __LANGUAGE_ASM__
  2645. //! @brief Set the TIM field to a new value.
  2646. #define BW_UART_UTIM_TIM(x, v) (HW_UART_UTIM_WR(x, (HW_UART_UTIM_RD(x) & ~BM_UART_UTIM_TIM) | BF_UART_UTIM_TIM(v)))
  2647. #endif
  2648. //@}
  2649. //-------------------------------------------------------------------------------------------
  2650. // HW_UART_UBIR - UART BRM Incremental Register
  2651. //-------------------------------------------------------------------------------------------
  2652. #ifndef __LANGUAGE_ASM__
  2653. /*!
  2654. * @brief HW_UART_UBIR - UART BRM Incremental Register (RW)
  2655. *
  2656. * Reset value: 0x00000000
  2657. *
  2658. * This register can be written by both software and hardware. When enabling the automatic baud rate
  2659. * detection feature hardware can write 0x000F value into the UBIR after finishing detecting baud
  2660. * rate. Hardware has higher priority when both software and hardware try to write it at the same
  2661. * cycle Note: The write priority in the new design is not same as the original UART. In the orginal
  2662. * design, software has higher priotiry than hardware when writing this register at the same time. .
  2663. * Please note software reset will reset the register to its reset value.
  2664. */
  2665. typedef union _hw_uart_ubir
  2666. {
  2667. reg32_t U;
  2668. struct _hw_uart_ubir_bitfields
  2669. {
  2670. unsigned INC : 16; //!< [15:0] Incremental Numerator.
  2671. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  2672. } B;
  2673. } hw_uart_ubir_t;
  2674. #endif
  2675. /*!
  2676. * @name Constants and macros for entire UART_UBIR register
  2677. */
  2678. //@{
  2679. #define HW_UART_UBIR_ADDR(x) (REGS_UART_BASE(x) + 0xa4)
  2680. #ifndef __LANGUAGE_ASM__
  2681. #define HW_UART_UBIR(x) (*(volatile hw_uart_ubir_t *) HW_UART_UBIR_ADDR(x))
  2682. #define HW_UART_UBIR_RD(x) (HW_UART_UBIR(x).U)
  2683. #define HW_UART_UBIR_WR(x, v) (HW_UART_UBIR(x).U = (v))
  2684. #define HW_UART_UBIR_SET(x, v) (HW_UART_UBIR_WR(x, HW_UART_UBIR_RD(x) | (v)))
  2685. #define HW_UART_UBIR_CLR(x, v) (HW_UART_UBIR_WR(x, HW_UART_UBIR_RD(x) & ~(v)))
  2686. #define HW_UART_UBIR_TOG(x, v) (HW_UART_UBIR_WR(x, HW_UART_UBIR_RD(x) ^ (v)))
  2687. #endif
  2688. //@}
  2689. /*
  2690. * constants & macros for individual UART_UBIR bitfields
  2691. */
  2692. /*! @name Register UART_UBIR, field INC[15:0] (RW)
  2693. *
  2694. * Incremental Numerator. Holds the numerator value minus one of the BRM ratio (see ). The UBIR
  2695. * register MUST be updated before the UBMR register for the baud rate to be updated correctly. If
  2696. * only one register is written to by software, the BRM will ignore this data until the other
  2697. * register is written to by software. Updating this field using byte accesses is not recommended
  2698. * and is undefined.
  2699. */
  2700. //@{
  2701. #define BP_UART_UBIR_INC (0) //!< Bit position for UART_UBIR_INC.
  2702. #define BM_UART_UBIR_INC (0x0000ffff) //!< Bit mask for UART_UBIR_INC.
  2703. //! @brief Get value of UART_UBIR_INC from a register value.
  2704. #define BG_UART_UBIR_INC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UBIR_INC) >> BP_UART_UBIR_INC)
  2705. //! @brief Format value for bitfield UART_UBIR_INC.
  2706. #define BF_UART_UBIR_INC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UBIR_INC) & BM_UART_UBIR_INC)
  2707. #ifndef __LANGUAGE_ASM__
  2708. //! @brief Set the INC field to a new value.
  2709. #define BW_UART_UBIR_INC(x, v) (HW_UART_UBIR_WR(x, (HW_UART_UBIR_RD(x) & ~BM_UART_UBIR_INC) | BF_UART_UBIR_INC(v)))
  2710. #endif
  2711. //@}
  2712. //-------------------------------------------------------------------------------------------
  2713. // HW_UART_UBMR - UART BRM Modulator Register
  2714. //-------------------------------------------------------------------------------------------
  2715. #ifndef __LANGUAGE_ASM__
  2716. /*!
  2717. * @brief HW_UART_UBMR - UART BRM Modulator Register (RW)
  2718. *
  2719. * Reset value: 0x00000000
  2720. *
  2721. * This register can be written by both software and hardware. When enabling the automatic baud rate
  2722. * detection feature hardware can write a proper value into the UBMR based on detected baud rate.
  2723. * Hardware has higher priority when both software and hardware try to write it at the same cycle
  2724. * Note: The write priority in the new design is not same as the original UART. In the orginal
  2725. * design, software has higher priotiry than hardware when writing this register at the same time. .
  2726. * Please note software reset will reset the register to its reset value.
  2727. */
  2728. typedef union _hw_uart_ubmr
  2729. {
  2730. reg32_t U;
  2731. struct _hw_uart_ubmr_bitfields
  2732. {
  2733. unsigned MOD : 16; //!< [15:0] Modulator Denominator.
  2734. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  2735. } B;
  2736. } hw_uart_ubmr_t;
  2737. #endif
  2738. /*!
  2739. * @name Constants and macros for entire UART_UBMR register
  2740. */
  2741. //@{
  2742. #define HW_UART_UBMR_ADDR(x) (REGS_UART_BASE(x) + 0xa8)
  2743. #ifndef __LANGUAGE_ASM__
  2744. #define HW_UART_UBMR(x) (*(volatile hw_uart_ubmr_t *) HW_UART_UBMR_ADDR(x))
  2745. #define HW_UART_UBMR_RD(x) (HW_UART_UBMR(x).U)
  2746. #define HW_UART_UBMR_WR(x, v) (HW_UART_UBMR(x).U = (v))
  2747. #define HW_UART_UBMR_SET(x, v) (HW_UART_UBMR_WR(x, HW_UART_UBMR_RD(x) | (v)))
  2748. #define HW_UART_UBMR_CLR(x, v) (HW_UART_UBMR_WR(x, HW_UART_UBMR_RD(x) & ~(v)))
  2749. #define HW_UART_UBMR_TOG(x, v) (HW_UART_UBMR_WR(x, HW_UART_UBMR_RD(x) ^ (v)))
  2750. #endif
  2751. //@}
  2752. /*
  2753. * constants & macros for individual UART_UBMR bitfields
  2754. */
  2755. /*! @name Register UART_UBMR, field MOD[15:0] (RW)
  2756. *
  2757. * Modulator Denominator. Holds the value of the denominator minus one of the BRM ratio (see ). The
  2758. * UBIR register MUST be updated before the UBMR register for the baud rate to be updated correctly.
  2759. * If only one register is written to by software, the BRM will ignore this data until the other
  2760. * register is written to by software. Updating this register using byte accesses is not recommended
  2761. * and undefined.
  2762. */
  2763. //@{
  2764. #define BP_UART_UBMR_MOD (0) //!< Bit position for UART_UBMR_MOD.
  2765. #define BM_UART_UBMR_MOD (0x0000ffff) //!< Bit mask for UART_UBMR_MOD.
  2766. //! @brief Get value of UART_UBMR_MOD from a register value.
  2767. #define BG_UART_UBMR_MOD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UBMR_MOD) >> BP_UART_UBMR_MOD)
  2768. //! @brief Format value for bitfield UART_UBMR_MOD.
  2769. #define BF_UART_UBMR_MOD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UBMR_MOD) & BM_UART_UBMR_MOD)
  2770. #ifndef __LANGUAGE_ASM__
  2771. //! @brief Set the MOD field to a new value.
  2772. #define BW_UART_UBMR_MOD(x, v) (HW_UART_UBMR_WR(x, (HW_UART_UBMR_RD(x) & ~BM_UART_UBMR_MOD) | BF_UART_UBMR_MOD(v)))
  2773. #endif
  2774. //@}
  2775. //-------------------------------------------------------------------------------------------
  2776. // HW_UART_UBRC - UART Baud Rate Count Register
  2777. //-------------------------------------------------------------------------------------------
  2778. #ifndef __LANGUAGE_ASM__
  2779. /*!
  2780. * @brief HW_UART_UBRC - UART Baud Rate Count Register (RO)
  2781. *
  2782. * Reset value: 0x00000004
  2783. */
  2784. typedef union _hw_uart_ubrc
  2785. {
  2786. reg32_t U;
  2787. struct _hw_uart_ubrc_bitfields
  2788. {
  2789. unsigned BCNT : 16; //!< [15:0] Baud Rate Count Register.
  2790. unsigned RESERVED0 : 16; //!< [31:16] Reserved
  2791. } B;
  2792. } hw_uart_ubrc_t;
  2793. #endif
  2794. /*!
  2795. * @name Constants and macros for entire UART_UBRC register
  2796. */
  2797. //@{
  2798. #define HW_UART_UBRC_ADDR(x) (REGS_UART_BASE(x) + 0xac)
  2799. #ifndef __LANGUAGE_ASM__
  2800. #define HW_UART_UBRC(x) (*(volatile hw_uart_ubrc_t *) HW_UART_UBRC_ADDR(x))
  2801. #define HW_UART_UBRC_RD(x) (HW_UART_UBRC(x).U)
  2802. #endif
  2803. //@}
  2804. /*
  2805. * constants & macros for individual UART_UBRC bitfields
  2806. */
  2807. /*! @name Register UART_UBRC, field BCNT[15:0] (RO)
  2808. *
  2809. * Baud Rate Count Register. This read only register is used to count the start bit of the incoming
  2810. * baud rate (if ADNIMP=1), or start bit + bit0 (if ADNIMP=0). When the measurement is done, the
  2811. * Baud Rate Count Register contains the number of UART internal clock cycles (clock after divider)
  2812. * present in an incoming bit. BCNT retains its value until the next Automatic Baud Rate Detection
  2813. * sequence has been initiated. The 16 bit Baud Rate Count register is reset to 4 and stays at hex
  2814. * FFFF in the case of an overflow.
  2815. */
  2816. //@{
  2817. #define BP_UART_UBRC_BCNT (0) //!< Bit position for UART_UBRC_BCNT.
  2818. #define BM_UART_UBRC_BCNT (0x0000ffff) //!< Bit mask for UART_UBRC_BCNT.
  2819. //! @brief Get value of UART_UBRC_BCNT from a register value.
  2820. #define BG_UART_UBRC_BCNT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UBRC_BCNT) >> BP_UART_UBRC_BCNT)
  2821. //@}
  2822. //-------------------------------------------------------------------------------------------
  2823. // HW_UART_ONEMS - UART One Millisecond Register
  2824. //-------------------------------------------------------------------------------------------
  2825. #ifndef __LANGUAGE_ASM__
  2826. /*!
  2827. * @brief HW_UART_ONEMS - UART One Millisecond Register (RW)
  2828. *
  2829. * Reset value: 0x00000000
  2830. *
  2831. * This register has been expanded from 16 bits to 24 bits. In previous versions, the 16-bit ONEMS
  2832. * can only support the maximum 65.535MHz (0xFFFFx1000) ref_clk . To support 4Mbps Bluetooth
  2833. * application with 66.5MHz module_clock , the value 0x103C4 (66.5M/1000) should be written into
  2834. * this register. In this case, the 16 bits are not enough to contain the 0x103C4. So this register
  2835. * was expanded to 24 bits to support high frequency of the ref_clk .
  2836. */
  2837. typedef union _hw_uart_onems
  2838. {
  2839. reg32_t U;
  2840. struct _hw_uart_onems_bitfields
  2841. {
  2842. unsigned ONEMS : 24; //!< [23:0] One Millisecond Register.
  2843. unsigned RESERVED0 : 8; //!< [31:24] Reserved
  2844. } B;
  2845. } hw_uart_onems_t;
  2846. #endif
  2847. /*!
  2848. * @name Constants and macros for entire UART_ONEMS register
  2849. */
  2850. //@{
  2851. #define HW_UART_ONEMS_ADDR(x) (REGS_UART_BASE(x) + 0xb0)
  2852. #ifndef __LANGUAGE_ASM__
  2853. #define HW_UART_ONEMS(x) (*(volatile hw_uart_onems_t *) HW_UART_ONEMS_ADDR(x))
  2854. #define HW_UART_ONEMS_RD(x) (HW_UART_ONEMS(x).U)
  2855. #define HW_UART_ONEMS_WR(x, v) (HW_UART_ONEMS(x).U = (v))
  2856. #define HW_UART_ONEMS_SET(x, v) (HW_UART_ONEMS_WR(x, HW_UART_ONEMS_RD(x) | (v)))
  2857. #define HW_UART_ONEMS_CLR(x, v) (HW_UART_ONEMS_WR(x, HW_UART_ONEMS_RD(x) & ~(v)))
  2858. #define HW_UART_ONEMS_TOG(x, v) (HW_UART_ONEMS_WR(x, HW_UART_ONEMS_RD(x) ^ (v)))
  2859. #endif
  2860. //@}
  2861. /*
  2862. * constants & macros for individual UART_ONEMS bitfields
  2863. */
  2864. /*! @name Register UART_ONEMS, field ONEMS[23:0] (RW)
  2865. *
  2866. * One Millisecond Register. This 24-bit register must contain the value of the UART internal
  2867. * frequency ( ref_clk in ) divided by 1000. The internal frequency is obtained after the UART BRM
  2868. * internal divider (F ( ref_clk ) = F( module_clock ) / RFDIV). In fact this register contains the
  2869. * value corresponding to the number of UART BRM internal clock cycles present in one millisecond.
  2870. * The ONEMS (and UTIM) registers value are used in the escape character detection feature ( ) to
  2871. * count the number of clock cycles left between two escape characters. The ONEMS register is also
  2872. * used in infrared special case mode (IRSC = UCR4[5] = 1'b1), see .
  2873. */
  2874. //@{
  2875. #define BP_UART_ONEMS_ONEMS (0) //!< Bit position for UART_ONEMS_ONEMS.
  2876. #define BM_UART_ONEMS_ONEMS (0x00ffffff) //!< Bit mask for UART_ONEMS_ONEMS.
  2877. //! @brief Get value of UART_ONEMS_ONEMS from a register value.
  2878. #define BG_UART_ONEMS_ONEMS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_ONEMS_ONEMS) >> BP_UART_ONEMS_ONEMS)
  2879. //! @brief Format value for bitfield UART_ONEMS_ONEMS.
  2880. #define BF_UART_ONEMS_ONEMS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_ONEMS_ONEMS) & BM_UART_ONEMS_ONEMS)
  2881. #ifndef __LANGUAGE_ASM__
  2882. //! @brief Set the ONEMS field to a new value.
  2883. #define BW_UART_ONEMS_ONEMS(x, v) (HW_UART_ONEMS_WR(x, (HW_UART_ONEMS_RD(x) & ~BM_UART_ONEMS_ONEMS) | BF_UART_ONEMS_ONEMS(v)))
  2884. #endif
  2885. //@}
  2886. //-------------------------------------------------------------------------------------------
  2887. // HW_UART_UTS - UART Test Register
  2888. //-------------------------------------------------------------------------------------------
  2889. #ifndef __LANGUAGE_ASM__
  2890. /*!
  2891. * @brief HW_UART_UTS - UART Test Register (RW)
  2892. *
  2893. * Reset value: 0x00000060
  2894. */
  2895. typedef union _hw_uart_uts
  2896. {
  2897. reg32_t U;
  2898. struct _hw_uart_uts_bitfields
  2899. {
  2900. unsigned SOFTRST : 1; //!< [0] Software Reset.
  2901. unsigned RESERVED0 : 2; //!< [2:1] Reserved
  2902. unsigned RXFULL : 1; //!< [3] RxFIFO FULL.
  2903. unsigned TXFULL : 1; //!< [4] TxFIFO FULL.
  2904. unsigned RXEMPTY : 1; //!< [5] RxFIFO Empty.
  2905. unsigned TXEMPTY : 1; //!< [6] TxFIFO Empty.
  2906. unsigned RESERVED1 : 2; //!< [8:7] Reserved
  2907. unsigned RXDBG : 1; //!< [9]
  2908. unsigned LOOPIR : 1; //!< [10] Loop TX and RX for IR Test (LOOPIR) .
  2909. unsigned DBGEN : 1; //!< [11]
  2910. unsigned LOOP : 1; //!< [12] Loop TX and RX for Test.
  2911. unsigned FRCPERR : 1; //!< [13] Force Parity Error.
  2912. unsigned RESERVED2 : 18; //!< [31:14] Reserved
  2913. } B;
  2914. } hw_uart_uts_t;
  2915. #endif
  2916. /*!
  2917. * @name Constants and macros for entire UART_UTS register
  2918. */
  2919. //@{
  2920. #define HW_UART_UTS_ADDR(x) (REGS_UART_BASE(x) + 0xb4)
  2921. #ifndef __LANGUAGE_ASM__
  2922. #define HW_UART_UTS(x) (*(volatile hw_uart_uts_t *) HW_UART_UTS_ADDR(x))
  2923. #define HW_UART_UTS_RD(x) (HW_UART_UTS(x).U)
  2924. #define HW_UART_UTS_WR(x, v) (HW_UART_UTS(x).U = (v))
  2925. #define HW_UART_UTS_SET(x, v) (HW_UART_UTS_WR(x, HW_UART_UTS_RD(x) | (v)))
  2926. #define HW_UART_UTS_CLR(x, v) (HW_UART_UTS_WR(x, HW_UART_UTS_RD(x) & ~(v)))
  2927. #define HW_UART_UTS_TOG(x, v) (HW_UART_UTS_WR(x, HW_UART_UTS_RD(x) ^ (v)))
  2928. #endif
  2929. //@}
  2930. /*
  2931. * constants & macros for individual UART_UTS bitfields
  2932. */
  2933. /*! @name Register UART_UTS, field SOFTRST[0] (RW)
  2934. *
  2935. * Software Reset. Indicates the status of the software reset ( SRST bit of UCR2).
  2936. *
  2937. * Values:
  2938. * - 0 - Software reset inactive
  2939. * - 1 - Software reset active
  2940. */
  2941. //@{
  2942. #define BP_UART_UTS_SOFTRST (0) //!< Bit position for UART_UTS_SOFTRST.
  2943. #define BM_UART_UTS_SOFTRST (0x00000001) //!< Bit mask for UART_UTS_SOFTRST.
  2944. //! @brief Get value of UART_UTS_SOFTRST from a register value.
  2945. #define BG_UART_UTS_SOFTRST(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_SOFTRST) >> BP_UART_UTS_SOFTRST)
  2946. //! @brief Format value for bitfield UART_UTS_SOFTRST.
  2947. #define BF_UART_UTS_SOFTRST(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_SOFTRST) & BM_UART_UTS_SOFTRST)
  2948. #ifndef __LANGUAGE_ASM__
  2949. //! @brief Set the SOFTRST field to a new value.
  2950. #define BW_UART_UTS_SOFTRST(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_SOFTRST) | BF_UART_UTS_SOFTRST(v)))
  2951. #endif
  2952. //@}
  2953. /*! @name Register UART_UTS, field RXFULL[3] (RW)
  2954. *
  2955. * RxFIFO FULL. Indicates the RxFIFO is full.
  2956. *
  2957. * Values:
  2958. * - 0 - The RxFIFO is not full
  2959. * - 1 - The RxFIFO is full
  2960. */
  2961. //@{
  2962. #define BP_UART_UTS_RXFULL (3) //!< Bit position for UART_UTS_RXFULL.
  2963. #define BM_UART_UTS_RXFULL (0x00000008) //!< Bit mask for UART_UTS_RXFULL.
  2964. //! @brief Get value of UART_UTS_RXFULL from a register value.
  2965. #define BG_UART_UTS_RXFULL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_RXFULL) >> BP_UART_UTS_RXFULL)
  2966. //! @brief Format value for bitfield UART_UTS_RXFULL.
  2967. #define BF_UART_UTS_RXFULL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_RXFULL) & BM_UART_UTS_RXFULL)
  2968. #ifndef __LANGUAGE_ASM__
  2969. //! @brief Set the RXFULL field to a new value.
  2970. #define BW_UART_UTS_RXFULL(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_RXFULL) | BF_UART_UTS_RXFULL(v)))
  2971. #endif
  2972. //@}
  2973. /*! @name Register UART_UTS, field TXFULL[4] (RW)
  2974. *
  2975. * TxFIFO FULL. Indicates the TxFIFO is full.
  2976. *
  2977. * Values:
  2978. * - 0 - The TxFIFO is not full
  2979. * - 1 - The TxFIFO is full
  2980. */
  2981. //@{
  2982. #define BP_UART_UTS_TXFULL (4) //!< Bit position for UART_UTS_TXFULL.
  2983. #define BM_UART_UTS_TXFULL (0x00000010) //!< Bit mask for UART_UTS_TXFULL.
  2984. //! @brief Get value of UART_UTS_TXFULL from a register value.
  2985. #define BG_UART_UTS_TXFULL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_TXFULL) >> BP_UART_UTS_TXFULL)
  2986. //! @brief Format value for bitfield UART_UTS_TXFULL.
  2987. #define BF_UART_UTS_TXFULL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_TXFULL) & BM_UART_UTS_TXFULL)
  2988. #ifndef __LANGUAGE_ASM__
  2989. //! @brief Set the TXFULL field to a new value.
  2990. #define BW_UART_UTS_TXFULL(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_TXFULL) | BF_UART_UTS_TXFULL(v)))
  2991. #endif
  2992. //@}
  2993. /*! @name Register UART_UTS, field RXEMPTY[5] (RW)
  2994. *
  2995. * RxFIFO Empty. Indicates the RxFIFO is empty.
  2996. *
  2997. * Values:
  2998. * - 0 - The RxFIFO is not empty
  2999. * - 1 - The RxFIFO is empty
  3000. */
  3001. //@{
  3002. #define BP_UART_UTS_RXEMPTY (5) //!< Bit position for UART_UTS_RXEMPTY.
  3003. #define BM_UART_UTS_RXEMPTY (0x00000020) //!< Bit mask for UART_UTS_RXEMPTY.
  3004. //! @brief Get value of UART_UTS_RXEMPTY from a register value.
  3005. #define BG_UART_UTS_RXEMPTY(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_RXEMPTY) >> BP_UART_UTS_RXEMPTY)
  3006. //! @brief Format value for bitfield UART_UTS_RXEMPTY.
  3007. #define BF_UART_UTS_RXEMPTY(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_RXEMPTY) & BM_UART_UTS_RXEMPTY)
  3008. #ifndef __LANGUAGE_ASM__
  3009. //! @brief Set the RXEMPTY field to a new value.
  3010. #define BW_UART_UTS_RXEMPTY(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_RXEMPTY) | BF_UART_UTS_RXEMPTY(v)))
  3011. #endif
  3012. //@}
  3013. /*! @name Register UART_UTS, field TXEMPTY[6] (RW)
  3014. *
  3015. * TxFIFO Empty. Indicates that the TxFIFO is empty.
  3016. *
  3017. * Values:
  3018. * - 0 - The TxFIFO is not empty
  3019. * - 1 - The TxFIFO is empty
  3020. */
  3021. //@{
  3022. #define BP_UART_UTS_TXEMPTY (6) //!< Bit position for UART_UTS_TXEMPTY.
  3023. #define BM_UART_UTS_TXEMPTY (0x00000040) //!< Bit mask for UART_UTS_TXEMPTY.
  3024. //! @brief Get value of UART_UTS_TXEMPTY from a register value.
  3025. #define BG_UART_UTS_TXEMPTY(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_TXEMPTY) >> BP_UART_UTS_TXEMPTY)
  3026. //! @brief Format value for bitfield UART_UTS_TXEMPTY.
  3027. #define BF_UART_UTS_TXEMPTY(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_TXEMPTY) & BM_UART_UTS_TXEMPTY)
  3028. #ifndef __LANGUAGE_ASM__
  3029. //! @brief Set the TXEMPTY field to a new value.
  3030. #define BW_UART_UTS_TXEMPTY(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_TXEMPTY) | BF_UART_UTS_TXEMPTY(v)))
  3031. #endif
  3032. //@}
  3033. /*! @name Register UART_UTS, field RXDBG[9] (RW)
  3034. *
  3035. * RX_fifo_debug_mode. This bit controls the operation of the RX fifo read counter when in debug
  3036. * mode.
  3037. *
  3038. * Values:
  3039. * - 0 - rx fifo read pointer does not increment
  3040. * - 1 - rx_fifo read pointer increments as normal
  3041. */
  3042. //@{
  3043. #define BP_UART_UTS_RXDBG (9) //!< Bit position for UART_UTS_RXDBG.
  3044. #define BM_UART_UTS_RXDBG (0x00000200) //!< Bit mask for UART_UTS_RXDBG.
  3045. //! @brief Get value of UART_UTS_RXDBG from a register value.
  3046. #define BG_UART_UTS_RXDBG(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_RXDBG) >> BP_UART_UTS_RXDBG)
  3047. //! @brief Format value for bitfield UART_UTS_RXDBG.
  3048. #define BF_UART_UTS_RXDBG(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_RXDBG) & BM_UART_UTS_RXDBG)
  3049. #ifndef __LANGUAGE_ASM__
  3050. //! @brief Set the RXDBG field to a new value.
  3051. #define BW_UART_UTS_RXDBG(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_RXDBG) | BF_UART_UTS_RXDBG(v)))
  3052. #endif
  3053. //@}
  3054. /*! @name Register UART_UTS, field LOOPIR[10] (RW)
  3055. *
  3056. * Loop TX and RX for IR Test (LOOPIR) . This bit controls loopback from transmitter to receiver in
  3057. * the InfraRed interface.
  3058. *
  3059. * Values:
  3060. * - 0 - No IR loop
  3061. * - 1 - Connect IR transmitter to IR receiver
  3062. */
  3063. //@{
  3064. #define BP_UART_UTS_LOOPIR (10) //!< Bit position for UART_UTS_LOOPIR.
  3065. #define BM_UART_UTS_LOOPIR (0x00000400) //!< Bit mask for UART_UTS_LOOPIR.
  3066. //! @brief Get value of UART_UTS_LOOPIR from a register value.
  3067. #define BG_UART_UTS_LOOPIR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_LOOPIR) >> BP_UART_UTS_LOOPIR)
  3068. //! @brief Format value for bitfield UART_UTS_LOOPIR.
  3069. #define BF_UART_UTS_LOOPIR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_LOOPIR) & BM_UART_UTS_LOOPIR)
  3070. #ifndef __LANGUAGE_ASM__
  3071. //! @brief Set the LOOPIR field to a new value.
  3072. #define BW_UART_UTS_LOOPIR(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_LOOPIR) | BF_UART_UTS_LOOPIR(v)))
  3073. #endif
  3074. //@}
  3075. /*! @name Register UART_UTS, field DBGEN[11] (RW)
  3076. *
  3077. * debug_enable . This bit controls whether to respond to the debug_req input signal.
  3078. *
  3079. * Values:
  3080. * - 0 - UART will go into debug mode when debug_req is HIGH
  3081. * - 1 - UART will not go into debug mode even if debug_req is HIGH
  3082. */
  3083. //@{
  3084. #define BP_UART_UTS_DBGEN (11) //!< Bit position for UART_UTS_DBGEN.
  3085. #define BM_UART_UTS_DBGEN (0x00000800) //!< Bit mask for UART_UTS_DBGEN.
  3086. //! @brief Get value of UART_UTS_DBGEN from a register value.
  3087. #define BG_UART_UTS_DBGEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_DBGEN) >> BP_UART_UTS_DBGEN)
  3088. //! @brief Format value for bitfield UART_UTS_DBGEN.
  3089. #define BF_UART_UTS_DBGEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_DBGEN) & BM_UART_UTS_DBGEN)
  3090. #ifndef __LANGUAGE_ASM__
  3091. //! @brief Set the DBGEN field to a new value.
  3092. #define BW_UART_UTS_DBGEN(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_DBGEN) | BF_UART_UTS_DBGEN(v)))
  3093. #endif
  3094. //@}
  3095. /*! @name Register UART_UTS, field LOOP[12] (RW)
  3096. *
  3097. * Loop TX and RX for Test. Controls loopback for test purposes. When LOOP is high, the receiver
  3098. * input is internally connected to the transmitter and ignores the RXD pin. The transmitter is
  3099. * unaffected by LOOP. If RXDMUXSEL (UCR3[2]) is set to 1, the loopback is applied on serial and
  3100. * IrDA signals. If RXDMUXSEL is set to 0, the loopback is only applied on serial signals.
  3101. *
  3102. * Values:
  3103. * - 0 - Normal receiver operation
  3104. * - 1 - Internally connect the transmitter output to the receiver input
  3105. */
  3106. //@{
  3107. #define BP_UART_UTS_LOOP (12) //!< Bit position for UART_UTS_LOOP.
  3108. #define BM_UART_UTS_LOOP (0x00001000) //!< Bit mask for UART_UTS_LOOP.
  3109. //! @brief Get value of UART_UTS_LOOP from a register value.
  3110. #define BG_UART_UTS_LOOP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_LOOP) >> BP_UART_UTS_LOOP)
  3111. //! @brief Format value for bitfield UART_UTS_LOOP.
  3112. #define BF_UART_UTS_LOOP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_LOOP) & BM_UART_UTS_LOOP)
  3113. #ifndef __LANGUAGE_ASM__
  3114. //! @brief Set the LOOP field to a new value.
  3115. #define BW_UART_UTS_LOOP(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_LOOP) | BF_UART_UTS_LOOP(v)))
  3116. #endif
  3117. //@}
  3118. /*! @name Register UART_UTS, field FRCPERR[13] (RW)
  3119. *
  3120. * Force Parity Error. Forces the transmitter to generate a parity error if parity is enabled.
  3121. * FRCPERR is provided for system debugging.
  3122. *
  3123. * Values:
  3124. * - 0 - Generate normal parity
  3125. * - 1 - Generate inverted parity (error)
  3126. */
  3127. //@{
  3128. #define BP_UART_UTS_FRCPERR (13) //!< Bit position for UART_UTS_FRCPERR.
  3129. #define BM_UART_UTS_FRCPERR (0x00002000) //!< Bit mask for UART_UTS_FRCPERR.
  3130. //! @brief Get value of UART_UTS_FRCPERR from a register value.
  3131. #define BG_UART_UTS_FRCPERR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UTS_FRCPERR) >> BP_UART_UTS_FRCPERR)
  3132. //! @brief Format value for bitfield UART_UTS_FRCPERR.
  3133. #define BF_UART_UTS_FRCPERR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UTS_FRCPERR) & BM_UART_UTS_FRCPERR)
  3134. #ifndef __LANGUAGE_ASM__
  3135. //! @brief Set the FRCPERR field to a new value.
  3136. #define BW_UART_UTS_FRCPERR(x, v) (HW_UART_UTS_WR(x, (HW_UART_UTS_RD(x) & ~BM_UART_UTS_FRCPERR) | BF_UART_UTS_FRCPERR(v)))
  3137. #endif
  3138. //@}
  3139. //-------------------------------------------------------------------------------------------
  3140. // HW_UART_UMCR - UART RS-485 Mode Control Register
  3141. //-------------------------------------------------------------------------------------------
  3142. #ifndef __LANGUAGE_ASM__
  3143. /*!
  3144. * @brief HW_UART_UMCR - UART RS-485 Mode Control Register (RW)
  3145. *
  3146. * Reset value: 0x00000000
  3147. */
  3148. typedef union _hw_uart_umcr
  3149. {
  3150. reg32_t U;
  3151. struct _hw_uart_umcr_bitfields
  3152. {
  3153. unsigned MDEN : 1; //!< [0] 9-bit data or Multidrop Mode (RS-485) Enable.
  3154. unsigned SLAM : 1; //!< [1] RS-485 Slave Address Detect Mode Selection.
  3155. unsigned TXB8 : 1; //!< [2] Transmit RS-485 bit 8 (the ninth bit or 9 th bit).
  3156. unsigned SADEN : 1; //!< [3] RS-485 Slave Address Detected Interrupt Enable.
  3157. unsigned RESERVED0 : 4; //!< [7:4] Reserved
  3158. unsigned SLADDR : 8; //!< [15:8] RS-485 Slave Address Character.
  3159. unsigned RESERVED1 : 16; //!< [31:16] Reserved
  3160. } B;
  3161. } hw_uart_umcr_t;
  3162. #endif
  3163. /*!
  3164. * @name Constants and macros for entire UART_UMCR register
  3165. */
  3166. //@{
  3167. #define HW_UART_UMCR_ADDR(x) (REGS_UART_BASE(x) + 0xb8)
  3168. #ifndef __LANGUAGE_ASM__
  3169. #define HW_UART_UMCR(x) (*(volatile hw_uart_umcr_t *) HW_UART_UMCR_ADDR(x))
  3170. #define HW_UART_UMCR_RD(x) (HW_UART_UMCR(x).U)
  3171. #define HW_UART_UMCR_WR(x, v) (HW_UART_UMCR(x).U = (v))
  3172. #define HW_UART_UMCR_SET(x, v) (HW_UART_UMCR_WR(x, HW_UART_UMCR_RD(x) | (v)))
  3173. #define HW_UART_UMCR_CLR(x, v) (HW_UART_UMCR_WR(x, HW_UART_UMCR_RD(x) & ~(v)))
  3174. #define HW_UART_UMCR_TOG(x, v) (HW_UART_UMCR_WR(x, HW_UART_UMCR_RD(x) ^ (v)))
  3175. #endif
  3176. //@}
  3177. /*
  3178. * constants & macros for individual UART_UMCR bitfields
  3179. */
  3180. /*! @name Register UART_UMCR, field MDEN[0] (RW)
  3181. *
  3182. * 9-bit data or Multidrop Mode (RS-485) Enable.
  3183. *
  3184. * Values:
  3185. * - 0 - Normal RS-232 or IrDA mode, see for detail.
  3186. * - 1 - Enable RS-485 mode, see for detail
  3187. */
  3188. //@{
  3189. #define BP_UART_UMCR_MDEN (0) //!< Bit position for UART_UMCR_MDEN.
  3190. #define BM_UART_UMCR_MDEN (0x00000001) //!< Bit mask for UART_UMCR_MDEN.
  3191. //! @brief Get value of UART_UMCR_MDEN from a register value.
  3192. #define BG_UART_UMCR_MDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UMCR_MDEN) >> BP_UART_UMCR_MDEN)
  3193. //! @brief Format value for bitfield UART_UMCR_MDEN.
  3194. #define BF_UART_UMCR_MDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UMCR_MDEN) & BM_UART_UMCR_MDEN)
  3195. #ifndef __LANGUAGE_ASM__
  3196. //! @brief Set the MDEN field to a new value.
  3197. #define BW_UART_UMCR_MDEN(x, v) (HW_UART_UMCR_WR(x, (HW_UART_UMCR_RD(x) & ~BM_UART_UMCR_MDEN) | BF_UART_UMCR_MDEN(v)))
  3198. #endif
  3199. //@}
  3200. /*! @name Register UART_UMCR, field SLAM[1] (RW)
  3201. *
  3202. * RS-485 Slave Address Detect Mode Selection.
  3203. *
  3204. * Values:
  3205. * - 0 - Select Normal Address Detect mode
  3206. * - 1 - Select Automatic Address Detect mode
  3207. */
  3208. //@{
  3209. #define BP_UART_UMCR_SLAM (1) //!< Bit position for UART_UMCR_SLAM.
  3210. #define BM_UART_UMCR_SLAM (0x00000002) //!< Bit mask for UART_UMCR_SLAM.
  3211. //! @brief Get value of UART_UMCR_SLAM from a register value.
  3212. #define BG_UART_UMCR_SLAM(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UMCR_SLAM) >> BP_UART_UMCR_SLAM)
  3213. //! @brief Format value for bitfield UART_UMCR_SLAM.
  3214. #define BF_UART_UMCR_SLAM(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UMCR_SLAM) & BM_UART_UMCR_SLAM)
  3215. #ifndef __LANGUAGE_ASM__
  3216. //! @brief Set the SLAM field to a new value.
  3217. #define BW_UART_UMCR_SLAM(x, v) (HW_UART_UMCR_WR(x, (HW_UART_UMCR_RD(x) & ~BM_UART_UMCR_SLAM) | BF_UART_UMCR_SLAM(v)))
  3218. #endif
  3219. //@}
  3220. /*! @name Register UART_UMCR, field TXB8[2] (RW)
  3221. *
  3222. * Transmit RS-485 bit 8 (the ninth bit or 9 th bit). In RS-485 mode, software writes TXB8 bit as
  3223. * the 9 th data bit to be transmitted.
  3224. *
  3225. * Values:
  3226. * - 0 - 0 will be transmitted as the RS485 9 th data bit
  3227. * - 1 - 1 will be transmitted as the RS485 9 th data bit
  3228. */
  3229. //@{
  3230. #define BP_UART_UMCR_TXB8 (2) //!< Bit position for UART_UMCR_TXB8.
  3231. #define BM_UART_UMCR_TXB8 (0x00000004) //!< Bit mask for UART_UMCR_TXB8.
  3232. //! @brief Get value of UART_UMCR_TXB8 from a register value.
  3233. #define BG_UART_UMCR_TXB8(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UMCR_TXB8) >> BP_UART_UMCR_TXB8)
  3234. //! @brief Format value for bitfield UART_UMCR_TXB8.
  3235. #define BF_UART_UMCR_TXB8(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UMCR_TXB8) & BM_UART_UMCR_TXB8)
  3236. #ifndef __LANGUAGE_ASM__
  3237. //! @brief Set the TXB8 field to a new value.
  3238. #define BW_UART_UMCR_TXB8(x, v) (HW_UART_UMCR_WR(x, (HW_UART_UMCR_RD(x) & ~BM_UART_UMCR_TXB8) | BF_UART_UMCR_TXB8(v)))
  3239. #endif
  3240. //@}
  3241. /*! @name Register UART_UMCR, field SADEN[3] (RW)
  3242. *
  3243. * RS-485 Slave Address Detected Interrupt Enable.
  3244. *
  3245. * Values:
  3246. * - 0 - Disable RS-485 Slave Address Detected Interrupt
  3247. * - 1 - Enable RS-485 Slave Address Detected Interrupt
  3248. */
  3249. //@{
  3250. #define BP_UART_UMCR_SADEN (3) //!< Bit position for UART_UMCR_SADEN.
  3251. #define BM_UART_UMCR_SADEN (0x00000008) //!< Bit mask for UART_UMCR_SADEN.
  3252. //! @brief Get value of UART_UMCR_SADEN from a register value.
  3253. #define BG_UART_UMCR_SADEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UMCR_SADEN) >> BP_UART_UMCR_SADEN)
  3254. //! @brief Format value for bitfield UART_UMCR_SADEN.
  3255. #define BF_UART_UMCR_SADEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UMCR_SADEN) & BM_UART_UMCR_SADEN)
  3256. #ifndef __LANGUAGE_ASM__
  3257. //! @brief Set the SADEN field to a new value.
  3258. #define BW_UART_UMCR_SADEN(x, v) (HW_UART_UMCR_WR(x, (HW_UART_UMCR_RD(x) & ~BM_UART_UMCR_SADEN) | BF_UART_UMCR_SADEN(v)))
  3259. #endif
  3260. //@}
  3261. /*! @name Register UART_UMCR, field SLADDR[15:8] (RW)
  3262. *
  3263. * RS-485 Slave Address Character. Holds the selected slave adress character that the receiver wil
  3264. * try to detect.
  3265. */
  3266. //@{
  3267. #define BP_UART_UMCR_SLADDR (8) //!< Bit position for UART_UMCR_SLADDR.
  3268. #define BM_UART_UMCR_SLADDR (0x0000ff00) //!< Bit mask for UART_UMCR_SLADDR.
  3269. //! @brief Get value of UART_UMCR_SLADDR from a register value.
  3270. #define BG_UART_UMCR_SLADDR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_UART_UMCR_SLADDR) >> BP_UART_UMCR_SLADDR)
  3271. //! @brief Format value for bitfield UART_UMCR_SLADDR.
  3272. #define BF_UART_UMCR_SLADDR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_UART_UMCR_SLADDR) & BM_UART_UMCR_SLADDR)
  3273. #ifndef __LANGUAGE_ASM__
  3274. //! @brief Set the SLADDR field to a new value.
  3275. #define BW_UART_UMCR_SLADDR(x, v) (HW_UART_UMCR_WR(x, (HW_UART_UMCR_RD(x) & ~BM_UART_UMCR_SLADDR) | BF_UART_UMCR_SLADDR(v)))
  3276. #endif
  3277. //@}
  3278. //-------------------------------------------------------------------------------------------
  3279. // hw_uart_t - module struct
  3280. //-------------------------------------------------------------------------------------------
  3281. /*!
  3282. * @brief All UART module registers.
  3283. */
  3284. #ifndef __LANGUAGE_ASM__
  3285. #pragma pack(1)
  3286. typedef struct _hw_uart
  3287. {
  3288. volatile hw_uart_urxd_t URXD; //!< UART Receiver Register
  3289. reg32_t _reserved0[15];
  3290. volatile hw_uart_utxd_t UTXD; //!< UART Transmitter Register
  3291. reg32_t _reserved1[15];
  3292. volatile hw_uart_ucr1_t UCR1; //!< UART Control Register 1
  3293. volatile hw_uart_ucr2_t UCR2; //!< UART Control Register 2
  3294. volatile hw_uart_ucr3_t UCR3; //!< UART Control Register 3
  3295. volatile hw_uart_ucr4_t UCR4; //!< UART Control Register 4
  3296. volatile hw_uart_ufcr_t UFCR; //!< UART FIFO Control Register
  3297. volatile hw_uart_usr1_t USR1; //!< UART Status Register 1
  3298. volatile hw_uart_usr2_t USR2; //!< UART Status Register 2
  3299. volatile hw_uart_uesc_t UESC; //!< UART Escape Character Register
  3300. volatile hw_uart_utim_t UTIM; //!< UART Escape Timer Register
  3301. volatile hw_uart_ubir_t UBIR; //!< UART BRM Incremental Register
  3302. volatile hw_uart_ubmr_t UBMR; //!< UART BRM Modulator Register
  3303. volatile hw_uart_ubrc_t UBRC; //!< UART Baud Rate Count Register
  3304. volatile hw_uart_onems_t ONEMS; //!< UART One Millisecond Register
  3305. volatile hw_uart_uts_t UTS; //!< UART Test Register
  3306. volatile hw_uart_umcr_t UMCR; //!< UART RS-485 Mode Control Register
  3307. } hw_uart_t;
  3308. #pragma pack()
  3309. //! @brief Macro to access all UART registers.
  3310. //! @param x UART instance number.
  3311. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  3312. //! use the '&' operator, like <code>&HW_UART(0)</code>.
  3313. #define HW_UART(x) (*(hw_uart_t *) REGS_UART_BASE(x))
  3314. #endif
  3315. #endif // __HW_UART_REGISTERS_H__
  3316. // v18/121106/1.2.2
  3317. // EOF