drv_ge2d.c 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470
  1. /**************************************************************************//**
  2. * @file 2d.c
  3. * @brief N9H30 GE2D driver source file
  4. *
  5. * @note
  6. * SPDX-License-Identifier: Apache-2.0
  7. * Copyright (C) 2018 Nuvoton Technology Corp. All rights reserved.
  8. *****************************************************************************/
  9. #include "rtthread.h"
  10. #include "NuMicro.h"
  11. #include <drv_sys.h>
  12. //#define DEBUG
  13. #define DEF_COND_WAIT 1
  14. static unsigned int GFX_BPP;
  15. static unsigned int GFX_WIDTH;
  16. static unsigned int GFX_HEIGHT;
  17. #if defined ( __GNUC__ ) && !(__CC_ARM)
  18. __attribute__((aligned(32))) static void *GFX_START_ADDR = NULL;
  19. __attribute__((aligned(32))) static void *GFX_PAT_ADDR = NULL;
  20. #else
  21. static __align(32) void *GFX_START_ADDR = NULL;
  22. static __align(32) void *GFX_PAT_ADDR = NULL;
  23. #endif
  24. #define PN 1 // Quadrant 1
  25. #define NN 2 // Quadrant 2
  26. #define NP 3 // Quadrant 3
  27. #define PP 4 // Quadrant 4
  28. #define ABS(x) (((x)>0)?(x):-(x))
  29. #define MAX(a,b) (((a)>(b))?(a):(b))
  30. /* octant code of line drawing */
  31. #define XpYpXl (0<<1) // XY octant position is 1~3 in Control register
  32. #define XpYpYl (1<<1)
  33. #define XpYmXl (2<<1)
  34. #define XpYmYl (3<<1)
  35. #define XmYpXl (4<<1)
  36. #define XmYpYl (5<<1)
  37. #define XmYmXl (6<<1)
  38. #define XmYmYl (7<<1)
  39. static MONOPATTERN MonoPatternData[6] =
  40. {
  41. {0x00000000, 0xff000000}, // HS_HORIZONTAL
  42. {0x08080808, 0x08080808}, // HS_VERTICAL
  43. {0x80402010, 0x08040201}, // HS_FDIAGONAL
  44. {0x01020408, 0x10204080}, // HS_BDIAGONAL
  45. {0x08080808, 0xff080808}, // HS_CROSS
  46. {0x81422418, 0x18244281} // HS_DIAGCROSS
  47. };
  48. static char _DrawMode = MODE_OPAQUE;
  49. static UINT32 _ColorKey = COLOR_KEY;
  50. static UINT32 _ColorKeyMask = 0xFFFFFF;
  51. static BOOL _EnableAlpha = FALSE;
  52. static int _AlphaKs, _AlphaKd;
  53. static BOOL _ClipEnable = FALSE;
  54. static BOOL _OutsideClip = FALSE;
  55. static UINT32 _ClipTL, _ClipBR;
  56. static int _PatternType;
  57. static unsigned char FontData8[256][8] =
  58. {
  59. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //0
  60. {0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E}, //1
  61. {0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E}, //2
  62. {0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00}, //3
  63. {0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00}, //4
  64. {0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C}, //5
  65. {0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C}, //6
  66. {0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00}, //7
  67. {0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF}, //8
  68. {0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00}, //9
  69. {0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF}, //10
  70. {0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78}, //11
  71. {0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18}, //12
  72. {0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0}, //13
  73. {0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0}, //14
  74. {0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99}, //15
  75. {0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00}, //16
  76. {0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00}, //17
  77. {0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18}, //18
  78. {0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00}, //19
  79. {0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00}, //20
  80. {0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC}, //21
  81. {0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00}, //22
  82. {0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF}, //23
  83. {0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00}, //24
  84. {0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00}, //25
  85. {0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00}, //26
  86. {0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00}, //27
  87. {0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00}, //28
  88. {0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00}, //29
  89. {0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00}, //30
  90. {0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00}, //31
  91. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //32
  92. {0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00}, //33
  93. {0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00}, //34
  94. {0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00}, //35
  95. {0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00}, //36
  96. {0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00}, //37
  97. {0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00}, //38
  98. {0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, //39
  99. {0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00}, //40
  100. {0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00}, //41
  101. {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00}, //42
  102. {0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00}, //43
  103. {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30}, //44
  104. {0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00}, //45
  105. {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00}, //46
  106. {0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00}, //47
  107. {0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00}, //48
  108. {0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00}, //49
  109. {0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00}, //50
  110. {0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00}, //51
  111. {0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00}, //52
  112. {0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00}, //53
  113. {0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00}, //54
  114. {0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00}, //55
  115. {0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00}, //56
  116. {0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00}, //57
  117. {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00}, //58
  118. {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30}, //59
  119. {0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00}, //60
  120. {0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00}, //61
  121. {0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00}, //62
  122. {0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00}, //63
  123. {0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00}, //64
  124. {0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00}, //65
  125. {0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00}, //66
  126. {0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00}, //67
  127. {0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00}, //68
  128. {0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00}, //69
  129. {0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00}, //70
  130. {0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00}, //71
  131. {0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00}, //72
  132. {0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00}, //73
  133. {0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00}, //74
  134. {0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00}, //75
  135. {0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00}, //76
  136. {0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00}, //77
  137. {0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00}, //78
  138. {0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00}, //79
  139. {0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00}, //80
  140. {0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00}, //81
  141. {0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00}, //82
  142. {0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00}, //83
  143. {0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00}, //84
  144. {0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00}, //85
  145. {0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00}, //86
  146. {0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00}, //87
  147. {0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00}, //88
  148. {0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00}, //89
  149. {0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00}, //90
  150. {0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00}, //91
  151. {0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00}, //92
  152. {0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00}, //93
  153. {0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00}, //94
  154. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF}, //95
  155. {0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, //96
  156. {0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00}, //97
  157. {0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00}, //98
  158. {0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00}, //99
  159. {0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00}, //100
  160. {0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00}, //101
  161. {0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00}, //102
  162. {0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8}, //103
  163. {0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00}, //104
  164. {0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00}, //105
  165. {0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78}, //106
  166. {0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00}, //107
  167. {0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00}, //108
  168. {0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00}, //109
  169. {0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00}, //110
  170. {0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00}, //111
  171. {0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0}, //112
  172. {0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E}, //113
  173. {0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00}, //114
  174. {0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00}, //115
  175. {0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00}, //116
  176. {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00}, //117
  177. {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00}, //118
  178. {0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00}, //119
  179. {0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00}, //120
  180. {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8}, //121
  181. {0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00}, //122
  182. {0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00}, //123
  183. {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00}, //124
  184. {0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00}, //125
  185. {0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //126
  186. {0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00}, //127
  187. {0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x0C, 0x06, 0x7C}, //128
  188. {0x00, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00}, //129
  189. {0x1C, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00}, //130
  190. {0x7E, 0x81, 0x3C, 0x06, 0x3E, 0x66, 0x3B, 0x00}, //131
  191. {0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00}, //132
  192. {0xE0, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00}, //133
  193. {0x30, 0x30, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00}, //134
  194. {0x00, 0x00, 0x7C, 0xC6, 0xC0, 0x78, 0x0C, 0x38}, //135
  195. {0x7E, 0x81, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00}, //136
  196. {0xCC, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00}, //137
  197. {0xE0, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00}, //138
  198. {0xCC, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00}, //139
  199. {0x7C, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00}, //140
  200. {0xE0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00}, //141
  201. {0xC6, 0x10, 0x7C, 0xC6, 0xFE, 0xC6, 0xC6, 0x00}, //142
  202. {0x30, 0x30, 0x00, 0x78, 0xCC, 0xFC, 0xCC, 0x00}, //143
  203. {0x1C, 0x00, 0xFC, 0x60, 0x78, 0x60, 0xFC, 0x00}, //144
  204. {0x00, 0x00, 0x7F, 0x0C, 0x7F, 0xCC, 0x7F, 0x00}, //145
  205. {0x3E, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCE, 0x00}, //146
  206. {0x78, 0x84, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00}, //147
  207. {0x00, 0xCC, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00}, //148
  208. {0x00, 0xE0, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00}, //149
  209. {0x78, 0x84, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00}, //150
  210. {0x00, 0xE0, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00}, //151
  211. {0x00, 0xCC, 0x00, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8}, //152
  212. {0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00}, //153
  213. {0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00}, //154
  214. {0x18, 0x18, 0x7E, 0xC0, 0xC0, 0x7E, 0x18, 0x18}, //155
  215. {0x38, 0x6C, 0x64, 0xF0, 0x60, 0xE6, 0xFC, 0x00}, //156
  216. {0xCC, 0xCC, 0x78, 0x30, 0xFC, 0x30, 0xFC, 0x30}, //157
  217. {0xF8, 0xCC, 0xCC, 0xFA, 0xC6, 0xCF, 0xC6, 0xC3}, //158
  218. {0x0E, 0x1B, 0x18, 0x3C, 0x18, 0x18, 0xD8, 0x70}, //159
  219. {0x1C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00}, //160
  220. {0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00}, //161
  221. {0x00, 0x1C, 0x00, 0x78, 0xCC, 0xCC, 0x78, 0x00}, //162
  222. {0x00, 0x1C, 0x00, 0xCC, 0xCC, 0xCC, 0x76, 0x00}, //163
  223. {0x00, 0xF8, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0x00}, //164
  224. {0xFC, 0x00, 0xCC, 0xEC, 0xFC, 0xDC, 0xCC, 0x00}, //165
  225. {0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00}, //166
  226. {0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00}, //167
  227. {0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3C, 0x00}, //168
  228. {0x00, 0x00, 0x00, 0xFC, 0xC0, 0xC0, 0x00, 0x00}, //169
  229. {0x00, 0x00, 0x00, 0xFC, 0x0C, 0x0C, 0x00, 0x00}, //170
  230. {0xC6, 0xCC, 0xD8, 0x36, 0x6B, 0xC2, 0x84, 0x0F}, //171
  231. {0xC3, 0xC6, 0xCC, 0xDB, 0x37, 0x6D, 0xCF, 0x03}, //172
  232. {0x18, 0x00, 0x18, 0x18, 0x3C, 0x3C, 0x18, 0x00}, //173
  233. {0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00}, //174
  234. {0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00}, //175
  235. {0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88}, //176
  236. {0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA}, //177
  237. {0xDB, 0xF6, 0xDB, 0x6F, 0xDB, 0x7E, 0xD7, 0xED}, //178
  238. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //179
  239. {0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18}, //180
  240. {0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18}, //181
  241. {0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36}, //182
  242. {0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36}, //183
  243. {0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18}, //184
  244. {0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36}, //185
  245. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //186
  246. {0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36}, //187
  247. {0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00}, //188
  248. {0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00}, //189
  249. {0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00}, //190
  250. {0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18}, //191
  251. {0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00}, //192
  252. {0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00}, //193
  253. {0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18}, //194
  254. {0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18}, //195
  255. {0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00}, //196
  256. {0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18}, //197
  257. {0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18}, //198
  258. {0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36}, //199
  259. {0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00}, //200
  260. {0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36}, //201
  261. {0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00}, //202
  262. {0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36}, //203
  263. {0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36}, //204
  264. {0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00}, //205
  265. {0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36}, //206
  266. {0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00}, //207
  267. {0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00}, //208
  268. {0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18}, //209
  269. {0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36}, //210
  270. {0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00}, //211
  271. {0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00}, //212
  272. {0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18}, //213
  273. {0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36}, //214
  274. {0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36}, //215
  275. {0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18}, //216
  276. {0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00}, //217
  277. {0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18}, //218
  278. {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, //219
  279. {0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF}, //220
  280. {0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0}, //221
  281. {0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F}, //222
  282. {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00}, //223
  283. {0x00, 0x00, 0x76, 0xDC, 0xC8, 0xDC, 0x76, 0x00}, //224
  284. {0x00, 0x78, 0xCC, 0xF8, 0xCC, 0xF8, 0xC0, 0xC0}, //225
  285. {0x00, 0xFC, 0xCC, 0xC0, 0xC0, 0xC0, 0xC0, 0x00}, //226
  286. {0x00, 0x00, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x00}, //227
  287. {0xFC, 0xCC, 0x60, 0x30, 0x60, 0xCC, 0xFC, 0x00}, //228
  288. {0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0x70, 0x00}, //229
  289. {0x00, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0}, //230
  290. {0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x00}, //231
  291. {0xFC, 0x30, 0x78, 0xCC, 0xCC, 0x78, 0x30, 0xFC}, //232
  292. {0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0x6C, 0x38, 0x00}, //233
  293. {0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x6C, 0xEE, 0x00}, //234
  294. {0x1C, 0x30, 0x18, 0x7C, 0xCC, 0xCC, 0x78, 0x00}, //235
  295. {0x00, 0x00, 0x7E, 0xDB, 0xDB, 0x7E, 0x00, 0x00}, //236
  296. {0x06, 0x0C, 0x7E, 0xDB, 0xDB, 0x7E, 0x60, 0xC0}, //237
  297. {0x38, 0x60, 0xC0, 0xF8, 0xC0, 0x60, 0x38, 0x00}, //238
  298. {0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00}, //239
  299. {0x00, 0x7E, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00}, //240
  300. {0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00}, //241
  301. {0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xFC, 0x00}, //242
  302. {0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xFC, 0x00}, //243
  303. {0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18}, //244
  304. {0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0x70}, //245
  305. {0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00}, //246
  306. {0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00}, //247
  307. {0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00}, //248
  308. {0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00}, //249
  309. {0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00}, //250
  310. {0x0F, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C}, //251
  311. {0x58, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00}, //252
  312. {0x70, 0x98, 0x30, 0x60, 0xF8, 0x00, 0x00, 0x00}, //253
  313. {0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00}, //254
  314. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} //255
  315. };
  316. static unsigned char FontData16[256][16] =
  317. {
  318. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //0
  319. {0x00, 0x00, 0x7E, 0x81, 0xA5, 0x81, 0x81, 0xBD, 0x99, 0x81, 0x81, 0x7E, 0x00, 0x00, 0x00, 0x00}, //1
  320. {0x00, 0x00, 0x7E, 0xFF, 0xDB, 0xFF, 0xFF, 0xC3, 0xE7, 0xFF, 0xFF, 0x7E, 0x00, 0x00, 0x00, 0x00}, //2
  321. {0x00, 0x00, 0x00, 0x00, 0x6C, 0xFE, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00}, //3
  322. {0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, //4
  323. {0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0xE7, 0xE7, 0xE7, 0x99, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //5
  324. {0x00, 0x00, 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //6
  325. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //7
  326. {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, //8
  327. {0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00}, //9
  328. {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, //10
  329. {0x00, 0x00, 0x1E, 0x0E, 0x1A, 0x32, 0x78, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00}, //11
  330. {0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //12
  331. {0x00, 0x00, 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x30, 0x30, 0x70, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00}, //13
  332. {0x00, 0x00, 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x63, 0x63, 0x67, 0xE7, 0xE6, 0xC0, 0x00, 0x00, 0x00}, //14
  333. {0x00, 0x00, 0x00, 0x18, 0x18, 0xDB, 0x3C, 0xE7, 0x3C, 0xDB, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //15
  334. {0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFE, 0xF8, 0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00}, //16
  335. {0x00, 0x02, 0x06, 0x0E, 0x1E, 0x3E, 0xFE, 0x3E, 0x1E, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00}, //17
  336. {0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00}, //18
  337. {0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00}, //19
  338. {0x00, 0x00, 0x7F, 0xDB, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, 0x00, 0x00, 0x00}, //20
  339. {0x00, 0x7C, 0xC6, 0x60, 0x38, 0x6C, 0xC6, 0xC6, 0x6C, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00}, //21
  340. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00}, //22
  341. {0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x7E, 0x00, 0x00, 0x00}, //23
  342. {0x00, 0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //24
  343. {0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00}, //25
  344. {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //26
  345. {0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //27
  346. {0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //28
  347. {0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6C, 0xFE, 0x6C, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //29
  348. {0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7C, 0x7C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00}, //30
  349. {0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x7C, 0x7C, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, //31
  350. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //32
  351. {0x00, 0x00, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //33
  352. {0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //34
  353. {0x00, 0x00, 0x00, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00}, //35
  354. {0x18, 0x18, 0x7C, 0xC6, 0xC2, 0xC0, 0x7C, 0x06, 0x86, 0xC6, 0x7C, 0x18, 0x18, 0x00, 0x00, 0x00}, //36
  355. {0x00, 0x00, 0x00, 0x00, 0xC2, 0xC6, 0x0C, 0x18, 0x30, 0x60, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x00}, //37
  356. {0x00, 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //38
  357. {0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //39
  358. {0x00, 0x00, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00}, //40
  359. {0x00, 0x00, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00}, //41
  360. {0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //42
  361. {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //43
  362. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00}, //44
  363. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //45
  364. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //46
  365. {0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00}, //47
  366. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xCE, 0xD6, 0xD6, 0xE6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //48
  367. {0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00}, //49
  368. {0x00, 0x00, 0x7C, 0xC6, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00}, //50
  369. {0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //51
  370. {0x00, 0x00, 0x0C, 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00, 0x00, 0x00}, //52
  371. {0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xFC, 0x0E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //53
  372. {0x00, 0x00, 0x38, 0x60, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //54
  373. {0x00, 0x00, 0xFE, 0xC6, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00}, //55
  374. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //56
  375. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x0C, 0x78, 0x00, 0x00, 0x00, 0x00}, //57
  376. {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, //58
  377. {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00}, //59
  378. {0x00, 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00}, //60
  379. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //61
  380. {0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00}, //62
  381. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x0C, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //63
  382. {0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xDE, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00, 0x00, 0x00, 0x00}, //64
  383. {0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //65
  384. {0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00}, //66
  385. {0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00}, //67
  386. {0x00, 0x00, 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 0x00, 0x00, 0x00}, //68
  387. {0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00}, //69
  388. {0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00}, //70
  389. {0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xDE, 0xC6, 0xC6, 0x66, 0x3A, 0x00, 0x00, 0x00, 0x00}, //71
  390. {0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //72
  391. {0x00, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //73
  392. {0x00, 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0xCC, 0x78, 0x00, 0x00, 0x00, 0x00}, //74
  393. {0x00, 0x00, 0xE6, 0x66, 0x6C, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00}, //75
  394. {0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00}, //76
  395. {0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //77
  396. {0x00, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //78
  397. {0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00}, //79
  398. {0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00}, //80
  399. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xDE, 0x7C, 0x0C, 0x0E, 0x00, 0x00}, //81
  400. {0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00}, //82
  401. {0x00, 0x00, 0x7C, 0xC6, 0xC6, 0x60, 0x38, 0x0C, 0x06, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //83
  402. {0x00, 0x00, 0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //84
  403. {0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //85
  404. {0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00}, //86
  405. {0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00}, //87
  406. {0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x6C, 0x38, 0x38, 0x6C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //88
  407. {0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //89
  408. {0x00, 0x00, 0xFE, 0xC6, 0x86, 0x0C, 0x18, 0x30, 0x60, 0xC2, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00}, //90
  409. {0x00, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, 0x00, 0x00, 0x00}, //91
  410. {0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00}, //92
  411. {0x00, 0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, 0x00, 0x00, 0x00}, //93
  412. {0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //94
  413. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00}, //95
  414. {0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //96
  415. {0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //97
  416. {0x00, 0x00, 0xE0, 0x60, 0x60, 0x78, 0x6C, 0x66, 0x66, 0x66, 0x66, 0xDC, 0x00, 0x00, 0x00, 0x00}, //98
  417. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //99
  418. {0x00, 0x00, 0x1C, 0x0C, 0x0C, 0x3C, 0x6C, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //100
  419. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //101
  420. {0x00, 0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00}, //102
  421. {0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xCC, 0x78, 0x00}, //103
  422. {0x00, 0x00, 0xE0, 0x60, 0x60, 0x6C, 0x76, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00}, //104
  423. {0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //105
  424. {0x00, 0x00, 0x06, 0x06, 0x00, 0x0E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 0x00}, //106
  425. {0x00, 0x00, 0xE0, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00}, //107
  426. {0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //108
  427. {0x00, 0x00, 0x00, 0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0x00, 0x00, 0x00, 0x00}, //109
  428. {0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00}, //110
  429. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //111
  430. {0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00}, //112
  431. {0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0x0C, 0x1E, 0x00}, //113
  432. {0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00}, //114
  433. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //115
  434. {0x00, 0x00, 0x10, 0x30, 0x30, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00}, //116
  435. {0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //117
  436. {0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00}, //118
  437. {0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, 0x00, 0x00, 0x00}, //119
  438. {0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00}, //120
  439. {0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0xF8, 0x00}, //121
  440. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xCC, 0x18, 0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00}, //122
  441. {0x00, 0x00, 0x0E, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0E, 0x00, 0x00, 0x00, 0x00}, //123
  442. {0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //124
  443. {0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00}, //125
  444. {0x00, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //126
  445. {0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00}, //127
  446. {0x00, 0x00, 0x3C, 0x66, 0xC2, 0xC0, 0xC0, 0xC0, 0xC2, 0x66, 0x3C, 0x0C, 0x06, 0x7C, 0x00, 0x00}, //128
  447. {0x00, 0x00, 0xCC, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //129
  448. {0x00, 0x0C, 0x18, 0x30, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //130
  449. {0x00, 0x10, 0x38, 0x6C, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //131
  450. {0x00, 0x00, 0xCC, 0xCC, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //132
  451. {0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //133
  452. {0x00, 0x38, 0x6C, 0x38, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //134
  453. {0x00, 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x60, 0x66, 0x3C, 0x0C, 0x06, 0x3C, 0x00, 0x00, 0x00}, //135
  454. {0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //136
  455. {0x00, 0x00, 0xC6, 0xC6, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //137
  456. {0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //138
  457. {0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //139
  458. {0x00, 0x18, 0x3C, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //140
  459. {0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //141
  460. {0x00, 0xC6, 0xC6, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //142
  461. {0x38, 0x6C, 0x38, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //143
  462. {0x18, 0x30, 0x60, 0x00, 0xFE, 0x66, 0x60, 0x7C, 0x60, 0x60, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00}, //144
  463. {0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x76, 0x36, 0x7E, 0xD8, 0xD8, 0x6E, 0x00, 0x00, 0x00, 0x00}, //145
  464. {0x00, 0x00, 0x3E, 0x6C, 0xCC, 0xCC, 0xFE, 0xCC, 0xCC, 0xCC, 0xCC, 0xCE, 0x00, 0x00, 0x00, 0x00}, //146
  465. {0x00, 0x10, 0x38, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //147
  466. {0x00, 0x00, 0xC6, 0xC6, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //148
  467. {0x00, 0x60, 0x30, 0x18, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //149
  468. {0x00, 0x30, 0x78, 0xCC, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //150
  469. {0x00, 0x60, 0x30, 0x18, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //151
  470. {0x00, 0x00, 0xC6, 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00}, //152
  471. {0x00, 0xC6, 0xC6, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00}, //153
  472. {0x00, 0xC6, 0xC6, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //154
  473. {0x00, 0x18, 0x18, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //155
  474. {0x00, 0x38, 0x6C, 0x64, 0x60, 0xF0, 0x60, 0x60, 0x60, 0x60, 0xE6, 0xFC, 0x00, 0x00, 0x00, 0x00}, //156
  475. {0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //157
  476. {0x00, 0xF8, 0xCC, 0xCC, 0xF8, 0xC4, 0xCC, 0xDE, 0xCC, 0xCC, 0xCC, 0xC6, 0x00, 0x00, 0x00, 0x00}, //158
  477. {0x00, 0x0E, 0x1B, 0x18, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0x70, 0x00, 0x00}, //159
  478. {0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //160
  479. {0x00, 0x0C, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00}, //161
  480. {0x00, 0x18, 0x30, 0x60, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //162
  481. {0x00, 0x18, 0x30, 0x60, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00}, //163
  482. {0x00, 0x00, 0x76, 0xDC, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00}, //164
  483. {0x76, 0xDC, 0x00, 0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //165
  484. {0x00, 0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //166
  485. {0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //167
  486. {0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xC0, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00}, //168
  487. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00}, //169
  488. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00}, //170
  489. {0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30, 0x60, 0xCE, 0x93, 0x06, 0x0C, 0x1F, 0x00, 0x00}, //171
  490. {0x00, 0xC0, 0xC0, 0xC2, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xCE, 0x9A, 0x3F, 0x06, 0x0F, 0x00, 0x00}, //172
  491. {0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00}, //173
  492. {0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //174
  493. {0x00, 0x00, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //175
  494. {0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44}, //176
  495. {0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA}, //177
  496. {0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77}, //178
  497. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //179
  498. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //180
  499. {0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //181
  500. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //182
  501. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //183
  502. {0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //184
  503. {0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //185
  504. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //186
  505. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //187
  506. {0x36, 0x36, 0x36, 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //188
  507. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //189
  508. {0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //190
  509. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //191
  510. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //192
  511. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //193
  512. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //194
  513. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //195
  514. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //196
  515. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //197
  516. {0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //198
  517. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //199
  518. {0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //200
  519. {0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //201
  520. {0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //202
  521. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //203
  522. {0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //204
  523. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //205
  524. {0x36, 0x36, 0x36, 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //206
  525. {0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //207
  526. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //208
  527. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //209
  528. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //210
  529. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //211
  530. {0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //212
  531. {0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //213
  532. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //214
  533. {0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xFF, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36}, //215
  534. {0x18, 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0xFF, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //216
  535. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //217
  536. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //218
  537. {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, //219
  538. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, //220
  539. {0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0}, //221
  540. {0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F}, //222
  541. {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //223
  542. {0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0xD8, 0xD8, 0xD8, 0xDC, 0x76, 0x00, 0x00, 0x00, 0x00}, //224
  543. {0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xC6, 0xFC, 0xC6, 0xC6, 0xFC, 0xC0, 0xC0, 0xC0, 0x00, 0x00}, //225
  544. {0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00}, //226
  545. {0x00, 0x00, 0x00, 0x00, 0x80, 0xFE, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00}, //227
  546. {0x00, 0x00, 0x00, 0xFE, 0xC6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xC6, 0xFE, 0x00, 0x00, 0x00, 0x00}, //228
  547. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xD8, 0xD8, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, 0x00, 0x00}, //229
  548. {0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xC0, 0x00, 0x00, 0x00}, //230
  549. {0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, //231
  550. {0x00, 0x00, 0x00, 0x7E, 0x18, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x00, 0x00, 0x00, 0x00}, //232
  551. {0x00, 0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00}, //233
  552. {0x00, 0x00, 0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x6C, 0x6C, 0x6C, 0xEE, 0x00, 0x00, 0x00, 0x00}, //234
  553. {0x00, 0x00, 0x1E, 0x30, 0x18, 0x0C, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00}, //235
  554. {0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0xDB, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //236
  555. {0x00, 0x00, 0x00, 0x03, 0x06, 0x7E, 0xCF, 0xDB, 0xF3, 0x7E, 0x60, 0xC0, 0x00, 0x00, 0x00, 0x00}, //237
  556. {0x00, 0x00, 0x1C, 0x30, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, 0x30, 0x1C, 0x00, 0x00, 0x00, 0x00}, //238
  557. {0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00}, //239
  558. {0x00, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00}, //240
  559. {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00}, //241
  560. {0x00, 0x00, 0x00, 0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00}, //242
  561. {0x00, 0x00, 0x00, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00}, //243
  562. {0x00, 0x00, 0x0E, 0x1B, 0x1B, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, //244
  563. {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xD8, 0xD8, 0xD8, 0x70, 0x00, 0x00, 0x00, 0x00}, //245
  564. {0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00}, //246
  565. {0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xDC, 0x00, 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //247
  566. {0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //248
  567. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //249
  568. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //250
  569. {0x00, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x6C, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x00}, //251
  570. {0x00, 0xD8, 0x6C, 0x6C, 0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //252
  571. {0x00, 0x70, 0x98, 0x30, 0x60, 0xC8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, //253
  572. {0x00, 0x00, 0x00, 0x00, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00}, //254
  573. {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} //255
  574. };
  575. struct nu_ge2d
  576. {
  577. char *name;
  578. IRQn_Type irqn;
  579. E_SYS_IPRST rstidx;
  580. E_SYS_IPCLK clkidx;
  581. rt_mutex_t lock;
  582. #if defined(DEF_COND_WAIT)
  583. rt_sem_t signal;
  584. #endif
  585. };
  586. typedef struct nu_ge2d *nu_ge2d_t;
  587. static struct nu_ge2d g_sNuGe2d =
  588. {
  589. .name = "GE2D",
  590. .irqn = IRQ_GE2D,
  591. .rstidx = GE2DRST,
  592. .clkidx = GE2DCKEN
  593. };
  594. #define NU_GE2D_LOCK() { \
  595. rt_err_t result = rt_mutex_take(g_sNuGe2d.lock, RT_WAITING_FOREVER); \
  596. RT_ASSERT(result == RT_EOK); \
  597. }
  598. #define NU_GE2D_UNLOCK() { \
  599. rt_err_t result = rt_mutex_release(g_sNuGe2d.lock); \
  600. RT_ASSERT(result == RT_EOK); \
  601. }
  602. #if defined(DEF_COND_WAIT)
  603. #define NU_GE2D_COND_WAIT() { \
  604. rt_err_t result = rt_sem_take(g_sNuGe2d.signal, RT_WAITING_FOREVER); \
  605. RT_ASSERT(result == RT_EOK); \
  606. }
  607. #define NU_GE2D_SIGNAL() { \
  608. rt_err_t result = rt_sem_release(g_sNuGe2d.signal); \
  609. RT_ASSERT(result == RT_EOK); \
  610. }
  611. /* Interrupt Service Routine for GE2D */
  612. static void nu_ge2d_isr(int vector, void *param)
  613. {
  614. /* Clear interrupt status. */
  615. outpw(REG_GE2D_INTSTS, 1);
  616. /* Signal condition-waiting to resume caller. */
  617. NU_GE2D_SIGNAL();
  618. }
  619. #else
  620. #define NU_GE2D_COND_WAIT() { \
  621. while ((inpw(REG_GE2D_INTSTS) & 0x01) == 0); \
  622. outpw(REG_GE2D_INTSTS, 1); \
  623. }
  624. #define NU_GE2D_SIGNAL()
  625. #endif
  626. static unsigned long make_color(int color)
  627. {
  628. UINT32 r, g, b;
  629. if (GFX_BPP == 8)
  630. {
  631. r = (color & 0x00e00000) >> 16; // 3 bits
  632. g = (color & 0x0000e000) >> 11; // 3 bits
  633. b = (color & 0x000000c0) >> 6; // 2 bits
  634. return (r | g | b);
  635. }
  636. else if (GFX_BPP == 16)
  637. {
  638. r = (color & 0x00f80000) >> 8; // 5 bits
  639. g = (color & 0x0000fc00) >> 5; // 6 bits
  640. b = (color & 0x000000f8) >> 3; // 5 bits
  641. return (r | g | b);
  642. }
  643. else return (UINT32)color;
  644. }
  645. /// @endcond /* HIDDEN_SYMBOLS */
  646. /**
  647. * @brief Clear the on screen buffer with a specified color.
  648. * @param[in] color clear with this color.
  649. * @return none
  650. */
  651. void ge2dClearScreen(int color)
  652. {
  653. UINT32 cmd32;
  654. UINT32 color32, dest_pitch, dest_dimension;
  655. color32 = make_color(color);
  656. cmd32 = 0xcc430040;
  657. outpw(REG_GE2D_CTL, cmd32);
  658. outpw(REG_GE2D_BGCOLR, color32); // fill with background color
  659. dest_pitch = GFX_WIDTH << 16; // pitch in pixels
  660. outpw(REG_GE2D_SDPITCH, dest_pitch);
  661. outpw(REG_GE2D_DSTSPA, 0); // starts from (0,0)
  662. dest_dimension = GFX_HEIGHT << 16 | GFX_WIDTH;
  663. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  664. outpw(REG_GE2D_TRG, 1);
  665. NU_GE2D_COND_WAIT();
  666. NU_GE2D_UNLOCK();
  667. }
  668. /**
  669. * @brief Set output data mask.
  670. * @param[in] mask is mask value
  671. * @return none
  672. */
  673. void ge2dSetWriteMask(int mask)
  674. {
  675. outpw(REG_GE2D_WRPLNMSK, make_color(mask));
  676. }
  677. /**
  678. * @brief Set source origin starting address.
  679. * @param[in] ptr pointer of start address
  680. * @return none
  681. */
  682. void ge2dSetSourceOriginStarting(void *ptr)
  683. {
  684. outpw(REG_GE2D_XYSORG, (int)ptr);
  685. }
  686. /**
  687. * @brief Set destination origin starting address.
  688. * @param[in] ptr pointer of start address
  689. * @return none
  690. */
  691. void ge2dSetDestinationOriginStarting(void *ptr)
  692. {
  693. outpw(REG_GE2D_XYDORG, (int)ptr);
  694. }
  695. /**
  696. * @brief Reset graphics engine.
  697. * @param none
  698. * @return none
  699. */
  700. void ge2dReset(void)
  701. {
  702. outpw(REG_GE2D_MISCTL, 0x40); // FIFO reset
  703. outpw(REG_GE2D_MISCTL, 0x00);
  704. outpw(REG_GE2D_MISCTL, 0x80); // Engine reset
  705. outpw(REG_GE2D_MISCTL, 0x00);
  706. }
  707. /**
  708. * @brief Graphics engine initialization.
  709. * @param[in] bpp bit per pixel
  710. * @param[in] width is width of display memory
  711. * @param[in] height is height of display memory
  712. * @param[in] destination is pointer of destination buffer address
  713. * @return none
  714. */
  715. void ge2dInit(int bpp, int width, int height, void *destination)
  716. {
  717. UINT32 data32;
  718. if (destination == NULL)
  719. return;
  720. NU_GE2D_LOCK();
  721. ge2dReset();
  722. GFX_WIDTH = width;
  723. GFX_HEIGHT = height;
  724. _DrawMode = MODE_TRANSPARENT;
  725. _ColorKey = COLOR_KEY;
  726. _ColorKeyMask = 0xFFFFFF;
  727. GFX_START_ADDR = (void *)destination;
  728. if (GFX_BPP != bpp)
  729. {
  730. GFX_BPP = bpp;
  731. if (GFX_PAT_ADDR != NULL)
  732. {
  733. rt_free_align(GFX_PAT_ADDR);
  734. GFX_PAT_ADDR = RT_NULL;
  735. }
  736. if (GFX_PAT_ADDR == NULL)
  737. {
  738. uint32_t u32Size = (8 * 8 * (GFX_BPP / 8)) * 2;
  739. GFX_PAT_ADDR = (void *)rt_malloc_align(u32Size, u32Size);
  740. RT_ASSERT(GFX_PAT_ADDR != RT_NULL);
  741. sysprintf("[%s] Allocated %d@0x%08x.\n", __func__, u32Size, GFX_PAT_ADDR);
  742. }
  743. }
  744. #ifdef DEBUG
  745. sysprintf("[%s]\n", __func__);
  746. sysprintf("screen width = %d\n", GFX_WIDTH);
  747. sysprintf("screen height = %d\n", GFX_HEIGHT);
  748. sysprintf("screen bpp = %d\n", GFX_BPP);
  749. sysprintf("destination = 0x%x\n", destination);
  750. #endif
  751. outpw(REG_GE2D_INTSTS, 1); // clear interrupt
  752. outpw(REG_GE2D_PATSA, (unsigned int)GFX_PAT_ADDR);
  753. outpw(REG_GE2D_CTL, 0); // disable interrupt
  754. outpw(REG_GE2D_XYDORG, (unsigned int)GFX_START_ADDR);
  755. outpw(REG_GE2D_XYSORG, (unsigned int)GFX_START_ADDR);
  756. outpw(REG_GE2D_WRPLNMSK, 0x00ffffff); // write plane mask
  757. data32 = GE_BPP_8; // default is 8 bpp
  758. if (GFX_BPP == 16)
  759. {
  760. data32 |= GE_BPP_16;
  761. }
  762. else if (GFX_BPP == 32)
  763. {
  764. data32 |= GE_BPP_32;
  765. }
  766. outpw(REG_GE2D_MISCTL, data32);
  767. }
  768. /**
  769. * @brief Reset FIFO of graphics engine.
  770. * @param none
  771. * @return none
  772. */
  773. void ge2dResetFIFO(void)
  774. {
  775. UINT32 temp32;
  776. temp32 = inpw(REG_GE2D_MISCTL);
  777. temp32 |= 0x00000040;
  778. outpw(REG_GE2D_MISCTL, temp32);
  779. temp32 &= 0xffffffbf;
  780. outpw(REG_GE2D_MISCTL, temp32);
  781. }
  782. /**
  783. * @brief Set BitBlt drawing mode.
  784. * @param[in] opt is drawing mode
  785. * @param[in] ckey is value of color key
  786. * @param[in] mask is value of color mask
  787. * @return none
  788. */
  789. void ge2dBitblt_SetDrawMode(int opt, int ckey, int mask)
  790. {
  791. if (opt == MODE_TRANSPARENT)
  792. {
  793. _DrawMode = MODE_TRANSPARENT;
  794. _ColorKey = make_color(ckey);
  795. _ColorKeyMask = make_color(mask);
  796. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  797. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  798. }
  799. else if (opt == MODE_DEST_TRANSPARENT)
  800. {
  801. _DrawMode = MODE_DEST_TRANSPARENT;
  802. _ColorKey = make_color(ckey);
  803. _ColorKeyMask = make_color(mask);
  804. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  805. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  806. }
  807. else
  808. {
  809. _DrawMode = MODE_OPAQUE; // default is OPAQUE
  810. }
  811. }
  812. /**
  813. * @brief Set alpha blending programming.
  814. * @param[in] opt is selection for enable or disable
  815. * @param[in] ks is value of alpha blending factor Ks
  816. * @param[in] kd is value of alpha blending factor Kd
  817. * @return none
  818. */
  819. int ge2dBitblt_SetAlphaMode(int opt, int ks, int kd)
  820. {
  821. if (ks + kd > 255)
  822. return -1;
  823. if (opt == 1)
  824. {
  825. _EnableAlpha = TRUE;
  826. _AlphaKs = ks;
  827. _AlphaKd = kd;
  828. }
  829. else
  830. {
  831. _EnableAlpha = FALSE;
  832. }
  833. return 0;
  834. }
  835. /**
  836. * @brief Screen-to-Screen BitBlt with SRCCOPY ROP operation.
  837. * @param[in] srcx is source x position
  838. * @param[in] srcy is source y position
  839. * @param[in] destx is destination x position
  840. * @param[in] desty is destination y position
  841. * @param[in] width is display width
  842. * @param[in] height is display width
  843. * @return none
  844. */
  845. void ge2dBitblt_ScreenToScreen(int srcx, int srcy, int destx, int desty, int width, int height)
  846. {
  847. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  848. UINT32 data32, alpha;
  849. #ifdef DEBUG
  850. sysprintf("screen_to_screen_blt():\n");
  851. sysprintf("(%d,%d)=>(%d,%d)\n", srcx, srcy, destx, desty);
  852. sysprintf("width=%d height=%d\n", width, height);
  853. #endif
  854. cmd32 = 0xcc430000;
  855. outpw(REG_GE2D_CTL, cmd32);
  856. if (srcx > destx) //+X
  857. {
  858. if (srcy > desty) //+Y
  859. {
  860. }
  861. else //-Y
  862. {
  863. cmd32 |= 0x08;
  864. srcy = srcy + height - 1;
  865. desty = desty + height - 1;
  866. }
  867. }
  868. else //-X
  869. {
  870. if (srcy > desty) //+Y
  871. {
  872. cmd32 |= 0x04; // 010
  873. srcx = srcx + width - 1;
  874. destx = destx + width - 1;
  875. }
  876. else //-Y
  877. {
  878. cmd32 |= 0xc; // 110
  879. srcx = srcx + width - 1;
  880. destx = destx + width - 1;
  881. srcy = srcy + height - 1;
  882. desty = desty + height - 1;
  883. }
  884. }
  885. #ifdef DEBUG
  886. sysprintf("new srcx=%d srcy=%d\n", srcx, srcy);
  887. sysprintf("new destx=%d desty=%d\n", destx, desty);
  888. #endif
  889. outpw(REG_GE2D_CTL, cmd32);
  890. pitch = GFX_WIDTH << 16 | GFX_WIDTH;
  891. outpw(REG_GE2D_SDPITCH, pitch);
  892. src_start = srcy << 16 | srcx;
  893. outpw(REG_GE2D_SRCSPA, src_start);
  894. dest_start = desty << 16 | destx;
  895. outpw(REG_GE2D_DSTSPA, dest_start);
  896. dimension = height << 16 | width;
  897. outpw(REG_GE2D_RTGLSZ, dimension);
  898. //
  899. // force to use the same starting address
  900. //
  901. outpw(REG_GE2D_XYSORG, (int)GFX_START_ADDR);
  902. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR); //smf
  903. if (_ClipEnable)
  904. {
  905. cmd32 |= 0x00000200;
  906. if (_OutsideClip)
  907. {
  908. cmd32 |= 0x00000100;
  909. }
  910. outpw(REG_GE2D_CTL, cmd32);
  911. outpw(REG_GE2D_CLPBTL, _ClipTL);
  912. outpw(REG_GE2D_CLPBBR, _ClipBR);
  913. }
  914. if (_DrawMode == MODE_TRANSPARENT)
  915. {
  916. cmd32 |= 0x00008000; // color transparency
  917. outpw(REG_GE2D_CTL, cmd32);
  918. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  919. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  920. }
  921. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  922. {
  923. cmd32 |= 0x00009000; // destination pixels control transparency
  924. outpw(REG_GE2D_CTL, cmd32);
  925. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  926. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  927. }
  928. if (_EnableAlpha)
  929. {
  930. cmd32 |= 0x00200000;
  931. outpw(REG_GE2D_CTL, cmd32);
  932. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  933. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  934. data32 |= (alpha << 16);
  935. outpw(REG_GE2D_MISCTL, data32);
  936. }
  937. outpw(REG_GE2D_TRG, 1);
  938. NU_GE2D_COND_WAIT();
  939. NU_GE2D_UNLOCK();
  940. }
  941. /**
  942. * @brief Screen-to-Screen BitBlt with ROP option.
  943. * @param[in] srcx is source x position
  944. * @param[in] srcy is source y position
  945. * @param[in] destx is destination x position
  946. * @param[in] desty is destination y position
  947. * @param[in] width is display width
  948. * @param[in] height is display width
  949. * @param[in] rop is rop option
  950. * @return none
  951. */
  952. void ge2dBitblt_ScreenToScreenRop(int srcx, int srcy, int destx, int desty, int width, int height, int rop)
  953. {
  954. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  955. UINT32 data32, alpha;
  956. #ifdef DEBUG
  957. sysprintf("screen_to_screen_rop_blt():\n");
  958. sysprintf("ROP=0x%x\n", rop);
  959. sysprintf("(%d,%d)=>(%d,%d)\n", srcx, srcy, destx, desty);
  960. sysprintf("width=%d height=%d\n", width, height);
  961. #endif
  962. cmd32 = 0x00430000 | (rop << 24);
  963. if (_PatternType == TYPE_MONO)
  964. {
  965. cmd32 |= 0x00000010; // default is TYPE_COLOR
  966. }
  967. outpw(REG_GE2D_CTL, cmd32);
  968. if (srcx > destx) //+X
  969. {
  970. if (srcy > desty) //+Y
  971. {
  972. }
  973. else //-Y
  974. {
  975. cmd32 |= 0x08;
  976. srcy = srcy + height - 1;
  977. desty = desty + height - 1;
  978. }
  979. }
  980. else //-X
  981. {
  982. if (srcy > desty) //+Y
  983. {
  984. cmd32 |= 0x04; // 010
  985. srcx = srcx + width - 1;
  986. destx = destx + width - 1;
  987. }
  988. else //-Y
  989. {
  990. cmd32 |= 0xc; // 110
  991. srcx = srcx + width - 1;
  992. destx = destx + width - 1;
  993. srcy = srcy + height - 1;
  994. desty = desty + height - 1;
  995. }
  996. }
  997. #ifdef DEBUG
  998. sysprintf("new srcx=%d srcy=%d\n", srcx, srcy);
  999. sysprintf("new destx=%d desty=%d\n", destx, desty);
  1000. #endif
  1001. outpw(REG_GE2D_CTL, cmd32);
  1002. pitch = GFX_WIDTH << 16 | GFX_WIDTH; // pitch in pixel
  1003. outpw(REG_GE2D_SDPITCH, pitch);
  1004. src_start = srcy << 16 | srcx;
  1005. outpw(REG_GE2D_SRCSPA, src_start);
  1006. dest_start = desty << 16 | destx;
  1007. outpw(REG_GE2D_DSTSPA, dest_start);
  1008. dimension = height << 16 | width;
  1009. outpw(REG_GE2D_RTGLSZ, dimension);
  1010. //
  1011. // force to use the same starting address
  1012. //
  1013. outpw(REG_GE2D_XYSORG, (int)GFX_START_ADDR);
  1014. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR); //smf
  1015. if (_ClipEnable)
  1016. {
  1017. cmd32 |= 0x00000200;
  1018. if (_OutsideClip)
  1019. {
  1020. cmd32 |= 0x00000100;
  1021. }
  1022. outpw(REG_GE2D_CTL, cmd32);
  1023. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1024. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1025. }
  1026. if (_DrawMode == MODE_TRANSPARENT)
  1027. {
  1028. cmd32 |= 0x00008000; // color transparency
  1029. outpw(REG_GE2D_CTL, cmd32);
  1030. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  1031. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  1032. }
  1033. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  1034. {
  1035. cmd32 |= 0x00009000;
  1036. outpw(REG_GE2D_CTL, cmd32);
  1037. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  1038. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  1039. }
  1040. if (_EnableAlpha)
  1041. {
  1042. cmd32 |= 0x00200000;
  1043. outpw(REG_GE2D_CTL, cmd32);
  1044. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  1045. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  1046. data32 |= (alpha << 16);
  1047. outpw(REG_GE2D_MISCTL, data32);
  1048. }
  1049. if ((rop == 0x00) || (rop == 0xff))
  1050. {
  1051. cmd32 = (cmd32 & 0xffff0fff) | 0x00009000;
  1052. outpw(REG_GE2D_CTL, cmd32);
  1053. }
  1054. outpw(REG_GE2D_TRG, 1);
  1055. NU_GE2D_COND_WAIT();
  1056. NU_GE2D_UNLOCK();
  1057. }
  1058. /**
  1059. * @brief Source to destination BitBlt with SRCCOPY ROP operation.
  1060. * @param[in] srcx is source x position
  1061. * @param[in] srcy is source y position
  1062. * @param[in] destx is destination x position
  1063. * @param[in] desty is destination y position
  1064. * @param[in] width is display width
  1065. * @param[in] height is display width
  1066. * @param[in] srcpitch is source pixel pitch
  1067. * @param[in] destpitch is destination pixel pitch
  1068. * @return none
  1069. * @note before calling this function, it would set the source and destination origin starting place
  1070. */
  1071. void ge2dBitblt_SourceToDestination(int srcx, int srcy, int destx, int desty, int width, int height, int srcpitch, int destpitch)
  1072. {
  1073. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  1074. UINT32 data32, alpha;
  1075. #ifdef DEBUG
  1076. sysprintf("source_to_destination_blt():\n");
  1077. sysprintf("(%d,%d)=>(%d,%d)\n", srcx, srcy, destx, desty);
  1078. sysprintf("width=%d height=%d\n", width, height);
  1079. #endif
  1080. cmd32 = 0xcc430000;
  1081. outpw(REG_GE2D_CTL, cmd32);
  1082. if (srcx > destx) //+X
  1083. {
  1084. if (srcy > desty) //+Y
  1085. {
  1086. }
  1087. else //-Y
  1088. {
  1089. cmd32 |= 0x08;
  1090. srcy = srcy + height - 1;
  1091. desty = desty + height - 1;
  1092. }
  1093. }
  1094. else //-X
  1095. {
  1096. if (srcy > desty) //+Y
  1097. {
  1098. cmd32 |= 0x04; // 010
  1099. srcx = srcx + width - 1;
  1100. destx = destx + width - 1;
  1101. }
  1102. else //-Y
  1103. {
  1104. cmd32 |= 0xc; // 110
  1105. srcx = srcx + width - 1;
  1106. destx = destx + width - 1;
  1107. srcy = srcy + height - 1;
  1108. desty = desty + height - 1;
  1109. }
  1110. }
  1111. #ifdef DEBUG
  1112. sysprintf("new srcx=%d srcy=%d\n", srcx, srcy);
  1113. sysprintf("new destx=%d desty=%d\n", destx, desty);
  1114. #endif
  1115. outpw(REG_GE2D_CTL, cmd32);
  1116. pitch = destpitch << 16 | srcpitch; // pitch in pixel, back | GFX_WIDTH ??
  1117. outpw(REG_GE2D_SDPITCH, pitch);
  1118. src_start = srcy << 16 | srcx;
  1119. outpw(REG_GE2D_SRCSPA, src_start);
  1120. dest_start = desty << 16 | destx;
  1121. outpw(REG_GE2D_DSTSPA, dest_start);
  1122. dimension = height << 16 | width;
  1123. outpw(REG_GE2D_RTGLSZ, dimension);
  1124. if (_ClipEnable)
  1125. {
  1126. cmd32 |= 0x00000200;
  1127. if (_OutsideClip)
  1128. {
  1129. cmd32 |= 0x00000100;
  1130. }
  1131. outpw(REG_GE2D_CTL, cmd32);
  1132. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1133. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1134. }
  1135. if (_DrawMode == MODE_TRANSPARENT)
  1136. {
  1137. cmd32 |= 0x00008000; // color transparency
  1138. outpw(REG_GE2D_CTL, cmd32);
  1139. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  1140. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  1141. }
  1142. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  1143. {
  1144. cmd32 |= 0x00009000; // destination pixels control transparency
  1145. outpw(REG_GE2D_CTL, cmd32);
  1146. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  1147. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  1148. }
  1149. if (_EnableAlpha)
  1150. {
  1151. cmd32 |= 0x00200000;
  1152. outpw(REG_GE2D_CTL, cmd32);
  1153. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  1154. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  1155. data32 |= (alpha << 16);
  1156. outpw(REG_GE2D_MISCTL, data32);
  1157. }
  1158. outpw(REG_GE2D_TRG, 1);
  1159. NU_GE2D_COND_WAIT();
  1160. NU_GE2D_UNLOCK();
  1161. }
  1162. /**
  1163. * @brief Set the clip rectangle. (top-left to down-right).
  1164. * @param[in] x1 is top-left x position
  1165. * @param[in] y1 is top-left y position
  1166. * @param[in] x2 is down-right x position
  1167. * @param[in] y2 is down-right y position
  1168. * @return none
  1169. */
  1170. void ge2dClip_SetClip(int x1, int y1, int x2, int y2)
  1171. {
  1172. #ifdef DEBUG
  1173. sysprintf("set_clip(): (%d,%d)-(%d,%d)\n", x1, y1, x2, y2);
  1174. #endif
  1175. if ((x1 >= 0) && (y1 >= 0) && (x2 >= 0) && (y2 >= 0))
  1176. {
  1177. if ((x2 > x1) && (y2 > y1))
  1178. {
  1179. _ClipEnable = TRUE;
  1180. /* hardware clipper not includes last pixel */
  1181. x2++;
  1182. y2++;
  1183. _ClipTL = (UINT32)((y1 << 16) | x1);
  1184. _ClipBR = (UINT32)((y2 << 16) | x2);
  1185. }
  1186. else
  1187. {
  1188. _ClipEnable = FALSE;
  1189. }
  1190. }
  1191. else
  1192. {
  1193. _ClipEnable = FALSE;
  1194. }
  1195. }
  1196. /**
  1197. * @brief Set the clip to inside clip or outside clip.
  1198. * @param[in] opt is option for setting clip inside or outside, value could be
  1199. * - \ref MODE_INSIDE_CLIP
  1200. * - \ref MODE_OUTSIDE_CLIP
  1201. * @return none
  1202. */
  1203. void ge2dClip_SetClipMode(int opt)
  1204. {
  1205. _OutsideClip = (opt == 0) ? FALSE : TRUE;
  1206. if (_OutsideClip)
  1207. {
  1208. #ifdef DEBUG
  1209. sysprintf("set_clip_mode(): OUTSIDE\n");
  1210. #endif
  1211. }
  1212. else
  1213. {
  1214. #ifdef DEBUG
  1215. sysprintf("set_clip_mode(): INSIDE\n");
  1216. #endif
  1217. }
  1218. }
  1219. /**
  1220. * @brief Draw an one-pixel rectangle frame.
  1221. * @param[in] x1 is top-left x position
  1222. * @param[in] y1 is top-left y position
  1223. * @param[in] x2 is down-right x position
  1224. * @param[in] y2 is down-right y position
  1225. * @param[in] color is color of this rectangle
  1226. * @param[in] opt is draw option, value could be
  1227. * - 0: rectangle
  1228. * - 1: diagonal
  1229. * @return none
  1230. */
  1231. void ge2dDrawFrame(int x1, int y1, int x2, int y2, int color, int opt)
  1232. {
  1233. UINT32 dest_pitch, dest_start, dest_dimension;
  1234. UINT32 color32;
  1235. #ifdef DEBUG
  1236. sysprintf("draw_frame():\n");
  1237. sysprintf("(%d,%d)-(%d,%d)\n", x1, y1, x2, y2);
  1238. sysprintf("color=0x%x opt=%d\n", color, opt);
  1239. #endif
  1240. /*
  1241. ** The opt==1 case must be specially handled.
  1242. */
  1243. if (opt == 0)
  1244. {
  1245. outpw(REG_GE2D_CTL, 0xcccb0000); // rectangle
  1246. }
  1247. else
  1248. {
  1249. outpw(REG_GE2D_CTL, 0xcccf0000); // diagonal
  1250. }
  1251. #ifdef DEBUG
  1252. sysprintf("(%d,%d)-(%d,%d)\n", x1, y1, x2, y2);
  1253. #endif
  1254. color32 = make_color(color);
  1255. outpw(REG_GE2D_FGCOLR, color32);
  1256. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1257. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1258. dest_start = y1 << 16 | x1;
  1259. outpw(REG_GE2D_DSTSPA, dest_start);
  1260. dest_dimension = (y2 - y1) << 16 | (x2 - x1);
  1261. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1262. outpw(REG_GE2D_MISCTL, inpw(REG_GE2D_MISCTL)); // address caculation
  1263. outpw(REG_GE2D_TRG, 1);
  1264. NU_GE2D_COND_WAIT();
  1265. NU_GE2D_UNLOCK();
  1266. }
  1267. /**
  1268. * @brief Draw an solid rectangle line.
  1269. * @param[in] x1 is top-left x position
  1270. * @param[in] y1 is top-left y position
  1271. * @param[in] x2 is down-right x position
  1272. * @param[in] y2 is down-right y position
  1273. * @param[in] color is color of this line
  1274. * @return none
  1275. */
  1276. void ge2dLine_DrawSolidLine(int x1, int y1, int x2, int y2, int color)
  1277. {
  1278. int abs_X, abs_Y, min, max;
  1279. UINT32 step_constant, initial_error, direction_code;
  1280. UINT32 cmd32, dest_pitch, dest_start;
  1281. #ifdef DEBUG
  1282. sysprintf("draw_solid_line():\n");
  1283. sysprintf("(%d,%d)-(%d,%d)\n", x1, y1, x2, y2);
  1284. sysprintf("color=0x%x\n", color);
  1285. #endif
  1286. abs_X = ABS(x2 - x1); //absolute value
  1287. abs_Y = ABS(y2 - y1); //absolute value
  1288. if (abs_X > abs_Y) // X major
  1289. {
  1290. max = abs_X;
  1291. min = abs_Y;
  1292. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1293. initial_error = (((UINT32)(2 * (min) - max)) << 16) | (UINT32)(max);
  1294. if (x2 > x1) // +X direction
  1295. {
  1296. if (y2 > y1) // +Y direction
  1297. direction_code = XpYpXl;
  1298. else // -Y direction
  1299. direction_code = XpYmXl;
  1300. }
  1301. else // -X direction
  1302. {
  1303. if (y2 > y1) // +Y direction
  1304. direction_code = XmYpXl;
  1305. else // -Y direction
  1306. direction_code = XmYmXl;
  1307. }
  1308. }
  1309. else // Y major
  1310. {
  1311. max = abs_Y;
  1312. min = abs_X;
  1313. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1314. initial_error = (((UINT32)(2 * (min) - max)) << 16) | (UINT32)(max);
  1315. if (x2 > x1) // +X direction
  1316. {
  1317. if (y2 > y1) // +Y direction
  1318. direction_code = XpYpYl;
  1319. else // -Y direction
  1320. direction_code = XpYmYl;
  1321. }
  1322. else // -X direction
  1323. {
  1324. if (y2 > y1) // +Y direction
  1325. direction_code = XmYpYl;
  1326. else // -Y direction
  1327. direction_code = XmYmYl;
  1328. }
  1329. }
  1330. outpw(REG_GE2D_BETSC, step_constant);
  1331. outpw(REG_GE2D_BIEPC, initial_error);
  1332. cmd32 = 0x008b0000 | direction_code;
  1333. outpw(REG_GE2D_CTL, cmd32);
  1334. outpw(REG_GE2D_BGCOLR, make_color(color));
  1335. outpw(REG_GE2D_FGCOLR, make_color(color));
  1336. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1337. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1338. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  1339. dest_start = y1 << 16 | x1;
  1340. outpw(REG_GE2D_DSTSPA, dest_start);
  1341. if (_ClipEnable)
  1342. {
  1343. cmd32 |= 0x00000200;
  1344. if (_OutsideClip)
  1345. {
  1346. cmd32 |= 0x00000100;
  1347. }
  1348. outpw(REG_GE2D_CTL, cmd32);
  1349. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1350. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1351. }
  1352. outpw(REG_GE2D_TRG, 1);
  1353. NU_GE2D_COND_WAIT();
  1354. NU_GE2D_UNLOCK();
  1355. }
  1356. /**
  1357. * @brief Draw an solid rectangle line with assigned RGB565 color
  1358. * @param[in] x1 is top-left x position
  1359. * @param[in] y1 is top-left y position
  1360. * @param[in] x2 is down-right x position
  1361. * @param[in] y2 is down-right y position
  1362. * @param[in] color is color of this line
  1363. * @return none
  1364. */
  1365. void ge2dLine_DrawSolidLine_RGB565(int x1, int y1, int x2, int y2, int color)
  1366. {
  1367. int abs_X, abs_Y, min, max;
  1368. UINT32 step_constant, initial_error, direction_code;
  1369. UINT32 cmd32, dest_pitch, dest_start;
  1370. #ifdef DEBUG
  1371. sysprintf("draw_solid_line():\n");
  1372. sysprintf("(%d,%d)-(%d,%d)\n", x1, y1, x2, y2);
  1373. sysprintf("color=0x%x\n", color);
  1374. #endif
  1375. abs_X = ABS(x2 - x1); //absolute value
  1376. abs_Y = ABS(y2 - y1); //absolute value
  1377. if (abs_X > abs_Y) // X major
  1378. {
  1379. max = abs_X;
  1380. min = abs_Y;
  1381. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1382. initial_error = (((UINT32)(2 * (min) - max)) << 16) | (UINT32)(max);
  1383. if (x2 > x1) // +X direction
  1384. {
  1385. if (y2 > y1) // +Y direction
  1386. direction_code = XpYpXl;
  1387. else // -Y direction
  1388. direction_code = XpYmXl;
  1389. }
  1390. else // -X direction
  1391. {
  1392. if (y2 > y1) // +Y direction
  1393. direction_code = XmYpXl;
  1394. else // -Y direction
  1395. direction_code = XmYmXl;
  1396. }
  1397. }
  1398. else // Y major
  1399. {
  1400. max = abs_Y;
  1401. min = abs_X;
  1402. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1403. initial_error = (((UINT32)(2 * (min) - max)) << 16) | (UINT32)(max);
  1404. if (x2 > x1) // +X direction
  1405. {
  1406. if (y2 > y1) // +Y direction
  1407. direction_code = XpYpYl;
  1408. else // -Y direction
  1409. direction_code = XpYmYl;
  1410. }
  1411. else // -X direction
  1412. {
  1413. if (y2 > y1) // +Y direction
  1414. direction_code = XmYpYl;
  1415. else // -Y direction
  1416. direction_code = XmYmYl;
  1417. }
  1418. }
  1419. outpw(REG_GE2D_BETSC, step_constant);
  1420. outpw(REG_GE2D_BIEPC, initial_error);
  1421. cmd32 = 0x008b0000 | direction_code;
  1422. outpw(REG_GE2D_CTL, cmd32);
  1423. outpw(REG_GE2D_BGCOLR, color);
  1424. outpw(REG_GE2D_FGCOLR, color);
  1425. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1426. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1427. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  1428. dest_start = y1 << 16 | x1;
  1429. outpw(REG_GE2D_DSTSPA, dest_start);
  1430. if (_ClipEnable)
  1431. {
  1432. cmd32 |= 0x00000200;
  1433. if (_OutsideClip)
  1434. {
  1435. cmd32 |= 0x00000100;
  1436. }
  1437. outpw(REG_GE2D_CTL, cmd32);
  1438. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1439. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1440. }
  1441. outpw(REG_GE2D_TRG, 1);
  1442. NU_GE2D_COND_WAIT();
  1443. NU_GE2D_UNLOCK();
  1444. }
  1445. /**
  1446. * @brief Draw a styled line.
  1447. * @param[in] x1 is top-left x position
  1448. * @param[in] y1 is top-left y position
  1449. * @param[in] x2 is down-right x position
  1450. * @param[in] y2 is down-right y position
  1451. * @param[in] style is style of line pattern
  1452. * @param[in] fgcolor is color of foreground
  1453. * @param[in] bkcolor is color of background
  1454. * @param[in] draw_mode is transparent is enable or not
  1455. * @return none
  1456. */
  1457. void ge2dLine_DrawStyledLine(int x1, int y1, int x2, int y2, int style, int fgcolor, int bkcolor, int draw_mode)
  1458. {
  1459. int abs_X, abs_Y, min, max;
  1460. UINT32 step_constant, initial_error, direction_code;
  1461. UINT32 cmd32, dest_pitch, dest_start;
  1462. UINT32 temp32, line_control_code;
  1463. abs_X = ABS(x2 - x1);
  1464. abs_Y = ABS(y2 - y1);
  1465. if (abs_X > abs_Y) // X major
  1466. {
  1467. max = abs_X;
  1468. min = abs_Y;
  1469. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1470. initial_error = (((UINT32)(2 * min - max)) << 16) | (UINT32)(max);
  1471. if (x2 > x1) // +X direction
  1472. {
  1473. if (y2 > y1) // +Y direction
  1474. direction_code = XpYpXl;
  1475. else // -Y direction
  1476. direction_code = XpYmXl;
  1477. }
  1478. else // -X direction
  1479. {
  1480. if (y2 > y1) // +Y direction
  1481. direction_code = XmYpXl;
  1482. else // -Y direction
  1483. direction_code = XmYmXl;
  1484. }
  1485. }
  1486. else // Y major
  1487. {
  1488. max = abs_Y;
  1489. min = abs_X;
  1490. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1491. initial_error = (((UINT32)(2 * min - max)) << 16) | (UINT32)(max);
  1492. if (x2 > x1) // +X direction
  1493. {
  1494. if (y2 > y1) // +Y direction
  1495. direction_code = XpYpYl;
  1496. else // -Y direction
  1497. direction_code = XpYmYl;
  1498. }
  1499. else // -X direction
  1500. {
  1501. if (y2 > y1) // +Y direction
  1502. direction_code = XmYpYl;
  1503. else // -Y direction
  1504. direction_code = XmYmYl;
  1505. }
  1506. }
  1507. outpw(REG_GE2D_BETSC, step_constant);
  1508. outpw(REG_GE2D_BIEPC, initial_error);
  1509. cmd32 = 0x009b0000 | direction_code; // styled line
  1510. if (draw_mode == MODE_TRANSPARENT)
  1511. {
  1512. cmd32 |= 0x00008000; // default is MODE_OPAQUE
  1513. }
  1514. outpw(REG_GE2D_CTL, cmd32);
  1515. outpw(REG_GE2D_BGCOLR, make_color(bkcolor));
  1516. outpw(REG_GE2D_FGCOLR, make_color(fgcolor));
  1517. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1518. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1519. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  1520. dest_start = y1 << 16 | x1;
  1521. outpw(REG_GE2D_DSTSPA, dest_start);
  1522. if (_ClipEnable)
  1523. {
  1524. cmd32 |= 0x00000200;
  1525. if (_OutsideClip)
  1526. {
  1527. cmd32 |= 0x00000100;
  1528. }
  1529. outpw(REG_GE2D_CTL, cmd32);
  1530. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1531. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1532. }
  1533. line_control_code = style;
  1534. temp32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  1535. temp32 = (line_control_code << 16) | temp32;
  1536. outpw(REG_GE2D_MISCTL, temp32); // address caculation
  1537. outpw(REG_GE2D_TRG, 1);
  1538. NU_GE2D_COND_WAIT();
  1539. NU_GE2D_UNLOCK();
  1540. }
  1541. /**
  1542. * @brief Draw a styled line using RGB565 color
  1543. * @param[in] x1 is top-left x position
  1544. * @param[in] y1 is top-left y position
  1545. * @param[in] x2 is down-right x position
  1546. * @param[in] y2 is down-right y position
  1547. * @param[in] style is style of line pattern
  1548. * @param[in] fgcolor is color of foreground
  1549. * @param[in] bkcolor is color of background
  1550. * @param[in] draw_mode is transparent is enable or not
  1551. * @return none
  1552. */
  1553. void ge2dLine_DrawStyledLine_RGB565(int x1, int y1, int x2, int y2, int style, int fgcolor, int bkcolor, int draw_mode)
  1554. {
  1555. int abs_X, abs_Y, min, max;
  1556. UINT32 step_constant, initial_error, direction_code;
  1557. UINT32 cmd32, dest_pitch, dest_start;
  1558. UINT32 temp32, line_control_code;
  1559. abs_X = ABS(x2 - x1);
  1560. abs_Y = ABS(y2 - y1);
  1561. if (abs_X > abs_Y) // X major
  1562. {
  1563. max = abs_X;
  1564. min = abs_Y;
  1565. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1566. initial_error = (((UINT32)(2 * min - max)) << 16) | (UINT32)(max);
  1567. if (x2 > x1) // +X direction
  1568. {
  1569. if (y2 > y1) // +Y direction
  1570. direction_code = XpYpXl;
  1571. else // -Y direction
  1572. direction_code = XpYmXl;
  1573. }
  1574. else // -X direction
  1575. {
  1576. if (y2 > y1) // +Y direction
  1577. direction_code = XmYpXl;
  1578. else // -Y direction
  1579. direction_code = XmYmXl;
  1580. }
  1581. }
  1582. else // Y major
  1583. {
  1584. max = abs_Y;
  1585. min = abs_X;
  1586. step_constant = (((UINT32)(2 * (min - max))) << 16) | (UINT32)(2 * min);
  1587. initial_error = (((UINT32)(2 * min - max)) << 16) | (UINT32)(max);
  1588. if (x2 > x1) // +X direction
  1589. {
  1590. if (y2 > y1) // +Y direction
  1591. direction_code = XpYpYl;
  1592. else // -Y direction
  1593. direction_code = XpYmYl;
  1594. }
  1595. else // -X direction
  1596. {
  1597. if (y2 > y1) // +Y direction
  1598. direction_code = XmYpYl;
  1599. else // -Y direction
  1600. direction_code = XmYmYl;
  1601. }
  1602. }
  1603. outpw(REG_GE2D_BETSC, step_constant);
  1604. outpw(REG_GE2D_BIEPC, initial_error);
  1605. cmd32 = 0x009b0000 | direction_code; // styled line
  1606. if (draw_mode == MODE_TRANSPARENT)
  1607. {
  1608. cmd32 |= 0x00008000; // default is MODE_OPAQUE
  1609. }
  1610. outpw(REG_GE2D_CTL, cmd32);
  1611. outpw(REG_GE2D_BGCOLR, bkcolor);
  1612. outpw(REG_GE2D_FGCOLR, fgcolor);
  1613. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1614. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1615. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  1616. dest_start = y1 << 16 | x1;
  1617. outpw(REG_GE2D_DSTSPA, dest_start);
  1618. if (_ClipEnable)
  1619. {
  1620. cmd32 |= 0x00000200;
  1621. if (_OutsideClip)
  1622. {
  1623. cmd32 |= 0x00000100;
  1624. }
  1625. outpw(REG_GE2D_CTL, cmd32);
  1626. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1627. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1628. }
  1629. line_control_code = style;
  1630. temp32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  1631. temp32 = (line_control_code << 16) | temp32;
  1632. outpw(REG_GE2D_MISCTL, temp32); // address caculation
  1633. outpw(REG_GE2D_TRG, 1);
  1634. NU_GE2D_COND_WAIT();
  1635. NU_GE2D_UNLOCK();
  1636. }
  1637. /**
  1638. * @brief Rectangle solid color fill with foreground color.
  1639. * @param[in] dx x position
  1640. * @param[in] dy y position
  1641. * @param[in] width is display width
  1642. * @param[in] height is display height
  1643. * @param[in] color is color of foreground
  1644. * @return none
  1645. */
  1646. void ge2dFill_Solid(int dx, int dy, int width, int height, int color)
  1647. {
  1648. UINT32 cmd32, color32;
  1649. UINT32 dest_start, dest_pitch, dest_dimension;
  1650. #ifdef DEBUG
  1651. sysprintf("solid_fill() begin\n");
  1652. sysprintf("(%d,%d)-(%d,%d)\n", dx, dy, dx + width - 1, dy + height - 1);
  1653. sysprintf("color=0x%x\n", color);
  1654. #endif
  1655. color32 = make_color(color);
  1656. cmd32 = 0xcc430060;
  1657. outpw(REG_GE2D_CTL, cmd32);
  1658. outpw(REG_GE2D_FGCOLR, color32); // fill with foreground color
  1659. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1660. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1661. dest_start = dy << 16 | dx;
  1662. outpw(REG_GE2D_DSTSPA, dest_start);
  1663. dest_dimension = height << 16 | width;
  1664. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1665. if (_ClipEnable)
  1666. {
  1667. cmd32 |= 0x00000200;
  1668. if (_OutsideClip)
  1669. {
  1670. cmd32 |= 0x00000100;
  1671. }
  1672. outpw(REG_GE2D_CTL, cmd32);
  1673. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1674. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1675. }
  1676. outpw(REG_GE2D_CTL, cmd32);
  1677. outpw(REG_GE2D_TRG, 1);
  1678. NU_GE2D_COND_WAIT();
  1679. NU_GE2D_UNLOCK();
  1680. }
  1681. /**
  1682. * @brief Rectangle solid color fill with RGB565 color.
  1683. * @param[in] dx x position
  1684. * @param[in] dy y position
  1685. * @param[in] width is display width
  1686. * @param[in] height is display height
  1687. * @param[in] color is RGB565 color of foreground
  1688. * @return none
  1689. */
  1690. void ge2dFill_Solid_RGB565(int dx, int dy, int width, int height, int color)
  1691. {
  1692. UINT32 cmd32;
  1693. UINT32 dest_start, dest_pitch, dest_dimension;
  1694. #ifdef DEBUG
  1695. sysprintf("solid_fill()\n");
  1696. sysprintf("(%d,%d)-(%d,%d)\n", dx, dy, dx + width - 1, dy + height - 1);
  1697. sysprintf("color=0x%x\n", color);
  1698. #endif
  1699. cmd32 = 0xcc430060;
  1700. outpw(REG_GE2D_CTL, cmd32);
  1701. outpw(REG_GE2D_FGCOLR, color); // fill with foreground color
  1702. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1703. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1704. dest_start = dy << 16 | dx;
  1705. outpw(REG_GE2D_DSTSPA, dest_start);
  1706. dest_dimension = height << 16 | width;
  1707. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1708. if (_ClipEnable)
  1709. {
  1710. cmd32 |= 0x00000200;
  1711. if (_OutsideClip)
  1712. {
  1713. cmd32 |= 0x00000100;
  1714. }
  1715. outpw(REG_GE2D_CTL, cmd32);
  1716. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1717. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1718. }
  1719. outpw(REG_GE2D_CTL, cmd32);
  1720. outpw(REG_GE2D_TRG, 1);
  1721. NU_GE2D_COND_WAIT();
  1722. NU_GE2D_UNLOCK();
  1723. }
  1724. /**
  1725. * @brief Rectangle solid color fill with background color.
  1726. * @param[in] dx x position
  1727. * @param[in] dy y position
  1728. * @param[in] width is display width
  1729. * @param[in] height is display height
  1730. * @param[in] color is color of background
  1731. * @return none
  1732. */
  1733. void ge2dFill_SolidBackground(int dx, int dy, int width, int height, int color)
  1734. {
  1735. UINT32 cmd32, color32;
  1736. UINT32 dest_start, dest_pitch, dest_dimension;
  1737. #ifdef DEBUG
  1738. sysprintf("solid_fill_back()\n");
  1739. sysprintf("(%d,%d)-(%d,%d)\n", dx, dy, dx + width - 1, dy + height - 1);
  1740. sysprintf("color=0x%x\n", color);
  1741. #endif
  1742. color32 = make_color(color);
  1743. cmd32 = 0xcc430040;
  1744. outpw(REG_GE2D_CTL, cmd32);
  1745. outpw(REG_GE2D_BGCOLR, color32); // fill with foreground color
  1746. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1747. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1748. dest_start = dy << 16 | dx;
  1749. outpw(REG_GE2D_DSTSPA, dest_start);
  1750. dest_dimension = height << 16 | width;
  1751. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1752. if (_ClipEnable)
  1753. {
  1754. cmd32 |= 0x00000200;
  1755. if (_OutsideClip)
  1756. {
  1757. cmd32 |= 0x00000100;
  1758. }
  1759. outpw(REG_GE2D_CTL, cmd32);
  1760. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1761. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1762. }
  1763. outpw(REG_GE2D_CTL, cmd32);
  1764. outpw(REG_GE2D_TRG, 1);
  1765. NU_GE2D_COND_WAIT();
  1766. NU_GE2D_UNLOCK();
  1767. }
  1768. /**
  1769. * @brief Rectangle fill with 8x8 color pattern.
  1770. * @param[in] dx x position
  1771. * @param[in] dy y position
  1772. * @param[in] width is display width
  1773. * @param[in] height is display height
  1774. * @return none
  1775. * @note The color pattern data is stored in the off-screen buffer.
  1776. */
  1777. void ge2dFill_ColorPattern(int dx, int dy, int width, int height)
  1778. {
  1779. UINT32 cmd32;
  1780. UINT32 dest_start, dest_pitch, dest_dimension;
  1781. #ifdef DEBUG
  1782. sysprintf("color_pattern_fill()\n");
  1783. sysprintf("(%d,%d)-(%d,%d)\n", dx, dy, dx + width - 1, dy + height - 1);
  1784. sysprintf("pattern offset (%d,%d)\n", dx % 8, dy % 8);
  1785. #endif
  1786. cmd32 = 0xf0430000;
  1787. outpw(REG_GE2D_CTL, cmd32);
  1788. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1789. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1790. dest_start = dy << 16 | dx;
  1791. outpw(REG_GE2D_DSTSPA, dest_start);
  1792. dest_dimension = height << 16 | width;
  1793. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1794. if (_ClipEnable)
  1795. {
  1796. cmd32 |= 0x00000200;
  1797. if (_OutsideClip)
  1798. {
  1799. cmd32 |= 0x00000100;
  1800. }
  1801. outpw(REG_GE2D_CTL, cmd32);
  1802. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1803. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1804. }
  1805. outpw(REG_GE2D_TRG, 1);
  1806. NU_GE2D_COND_WAIT();
  1807. NU_GE2D_UNLOCK();
  1808. }
  1809. /**
  1810. * @brief Rectangle fill with 8x8 mono pattern.
  1811. * @param[in] dx x position
  1812. * @param[in] dy y position
  1813. * @param[in] width is display width
  1814. * @param[in] height is display height
  1815. * @param[in] opt is transparent is enable or not
  1816. * @return none
  1817. */
  1818. void ge2dFill_MonoPattern(int dx, int dy, int width, int height, int opt)
  1819. {
  1820. UINT32 cmd32;
  1821. UINT32 dest_start, dest_pitch, dest_dimension;
  1822. #ifdef DEBUG
  1823. sysprintf("mono_pattern_fill()\n");
  1824. sysprintf("(%d,%d)-(%d,%d)\n", dx, dy, dx + width - 1, dy + height - 1);
  1825. #endif
  1826. cmd32 = 0xf0430010;
  1827. if (opt == MODE_TRANSPARENT)
  1828. {
  1829. cmd32 |= 0x00006000;
  1830. }
  1831. outpw(REG_GE2D_CTL, cmd32);
  1832. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1833. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1834. dest_start = dy << 16 | dx;
  1835. outpw(REG_GE2D_DSTSPA, dest_start);
  1836. dest_dimension = height << 16 | width;
  1837. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1838. if (_ClipEnable)
  1839. {
  1840. cmd32 |= 0x00000200;
  1841. if (_OutsideClip)
  1842. {
  1843. cmd32 |= 0x00000100;
  1844. }
  1845. outpw(REG_GE2D_CTL, cmd32);
  1846. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1847. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1848. }
  1849. outpw(REG_GE2D_TRG, 1);
  1850. NU_GE2D_COND_WAIT();
  1851. NU_GE2D_UNLOCK();
  1852. }
  1853. /**
  1854. * @brief Rectangle fill with 8x8 color pattern.
  1855. * @param[in] sx x position
  1856. * @param[in] sy y position
  1857. * @param[in] width is display width
  1858. * @param[in] height is display height
  1859. * @param[in] rop is ROP operation code
  1860. * @return none
  1861. */
  1862. void ge2dFill_ColorPatternROP(int sx, int sy, int width, int height, int rop)
  1863. {
  1864. UINT32 cmd32;
  1865. UINT32 dest_start, dest_pitch, dest_dimension;
  1866. #ifdef DEBUG
  1867. sysprintf("color_pattern_fill()\n");
  1868. sysprintf("(%d,%d)-(%d,%d)\n", sx, sy, sx + width - 1, sy + height - 1);
  1869. sysprintf("pattern offset (%d,%d)\n", sx % 8, sy % 8);
  1870. #endif
  1871. cmd32 = 0x00430000 | (rop << 24);
  1872. outpw(REG_GE2D_CTL, cmd32);
  1873. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1874. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1875. dest_start = sy << 16 | sx;
  1876. outpw(REG_GE2D_DSTSPA, dest_start);
  1877. dest_dimension = height << 16 | width;
  1878. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1879. if (_ClipEnable)
  1880. {
  1881. cmd32 |= 0x00000200;
  1882. if (_OutsideClip)
  1883. {
  1884. cmd32 |= 0x00000100;
  1885. }
  1886. outpw(REG_GE2D_CTL, cmd32);
  1887. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1888. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1889. }
  1890. outpw(REG_GE2D_TRG, 1);
  1891. NU_GE2D_COND_WAIT();
  1892. NU_GE2D_UNLOCK();
  1893. }
  1894. /**
  1895. * @brief Rectangle fill with 8x8 mono pattern.
  1896. * @param[in] sx x position
  1897. * @param[in] sy y position
  1898. * @param[in] width is display width
  1899. * @param[in] height is display height
  1900. * @param[in] opt is transparent is enable or not
  1901. * @param[in] rop is ROP operation code
  1902. * @return none
  1903. */
  1904. void ge2dFill_MonoPatternROP(int sx, int sy, int width, int height, int rop, int opt)
  1905. {
  1906. UINT32 cmd32;
  1907. UINT32 dest_start, dest_pitch, dest_dimension;
  1908. #ifdef DEBUG
  1909. sysprintf("mono_pattern_fill()\n");
  1910. sysprintf("(%d,%d)-(%d,%d)\n", sx, sy, sx + width - 1, sy + height - 1);
  1911. #endif
  1912. cmd32 = 0x00430010 | (rop << 24);
  1913. if (opt == MODE_TRANSPARENT)
  1914. {
  1915. cmd32 |= 0x00006000;
  1916. }
  1917. outpw(REG_GE2D_CTL, cmd32);
  1918. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  1919. outpw(REG_GE2D_SDPITCH, dest_pitch);
  1920. dest_start = sy << 16 | sx;
  1921. outpw(REG_GE2D_DSTSPA, dest_start);
  1922. dest_dimension = height << 16 | width;
  1923. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  1924. if (_ClipEnable)
  1925. {
  1926. cmd32 |= 0x00000200;
  1927. if (_OutsideClip)
  1928. {
  1929. cmd32 |= 0x00000100;
  1930. }
  1931. outpw(REG_GE2D_CTL, cmd32);
  1932. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1933. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1934. }
  1935. outpw(REG_GE2D_TRG, 1);
  1936. NU_GE2D_COND_WAIT();
  1937. NU_GE2D_UNLOCK();
  1938. }
  1939. /**
  1940. * @brief TileBLT function.
  1941. * @param[in] srcx source x position
  1942. * @param[in] srcy source y position
  1943. * @param[in] destx destination x position
  1944. * @param[in] desty destination y position
  1945. * @param[in] width is display width
  1946. * @param[in] height is display height
  1947. * @param[in] x_count is tile count for x-axis
  1948. * @param[in] y_count is tile count for y-axis
  1949. * @return none
  1950. */
  1951. void ge2dFill_TileBlt(int srcx, int srcy, int destx, int desty, int width, int height, int x_count, int y_count)
  1952. {
  1953. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  1954. UINT32 tile_ctl;
  1955. #ifdef DEBUG
  1956. sysprintf("tile_blt_image()\n");
  1957. sysprintf("(%d,%d)=>(%d,%d)\n", srcx, srcy, destx, desty);
  1958. sysprintf("width=%d height=%d\n", width, height);
  1959. sysprintf("%dx%d grids\n", x_count, y_count);
  1960. #endif
  1961. if (x_count > 0) x_count--;
  1962. if (y_count > 0) y_count--;
  1963. cmd32 = 0xcc430400; // b10 is the tile control
  1964. outpw(REG_GE2D_CTL, cmd32);
  1965. pitch = GFX_WIDTH << 16 | GFX_WIDTH; // pitch in pixel
  1966. outpw(REG_GE2D_SDPITCH, pitch);
  1967. src_start = srcy << 16 | srcx; // redundancy ??
  1968. outpw(REG_GE2D_SRCSPA, src_start); // redundancy ??
  1969. dest_start = desty << 16 | destx;
  1970. outpw(REG_GE2D_DSTSPA, dest_start);
  1971. dimension = height << 16 | width;
  1972. outpw(REG_GE2D_RTGLSZ, dimension);
  1973. if (_ClipEnable)
  1974. {
  1975. cmd32 |= 0x00000200;
  1976. if (_OutsideClip)
  1977. {
  1978. cmd32 |= 0x00000100;
  1979. }
  1980. outpw(REG_GE2D_CTL, cmd32);
  1981. outpw(REG_GE2D_CLPBTL, _ClipTL);
  1982. outpw(REG_GE2D_CLPBBR, _ClipBR);
  1983. }
  1984. tile_ctl = (y_count << 8) | (x_count);
  1985. outpw(REG_GE2D_TCNTVHSF, tile_ctl);
  1986. outpw(REG_GE2D_TRG, 1);
  1987. NU_GE2D_COND_WAIT();
  1988. NU_GE2D_UNLOCK();
  1989. }
  1990. /**
  1991. * @brief Host-to-Screen BitBlt with SRCCOPY (through data port)
  1992. * @param[in] x x position
  1993. * @param[in] y y position
  1994. * @param[in] width is display width
  1995. * @param[in] height is display height
  1996. * @param[in] buf is pointer of HostBLT data
  1997. * @return none
  1998. */
  1999. void ge2dHostBlt_Write(int x, int y, int width, int height, void *buf)
  2000. {
  2001. UINT32 cmd32, dest_pitch, dest_start, dest_dimension;
  2002. int transfer_count, i, j;
  2003. UINT32 *ptr32, data32;
  2004. #ifdef DEBUG
  2005. sysprintf("host_write_blt()\n");
  2006. sysprintf("(%d,%d)-(%d,%d)\n", x, y, x + width - 1, y + height - 1);
  2007. sysprintf("width=%d height=%d\n", width, height);
  2008. #endif
  2009. cmd32 = 0xcc430020;
  2010. outpw(REG_GE2D_CTL, cmd32);
  2011. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  2012. outpw(REG_GE2D_SDPITCH, dest_pitch);
  2013. dest_start = y << 16 | x;
  2014. outpw(REG_GE2D_DSTSPA, dest_start);
  2015. dest_dimension = height << 16 | width;
  2016. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2017. outpw(REG_GE2D_TRG, 1);
  2018. ptr32 = (UINT32 *)buf;
  2019. for (i = 0; i < height; i++) // 120
  2020. {
  2021. transfer_count = (width * (GFX_BPP / 8) + 3) / 4; // 4-byte count
  2022. while (transfer_count >= 8)
  2023. {
  2024. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2025. for (j = 0; j < 8; j++)
  2026. {
  2027. data32 = *ptr32++;
  2028. outpw(REG_GE2D_GEHBDW0, data32);
  2029. }
  2030. transfer_count -= 8;
  2031. }
  2032. if (transfer_count > 0)
  2033. {
  2034. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2035. for (j = 0; j < transfer_count; j++)
  2036. {
  2037. data32 = *ptr32++;
  2038. outpw(REG_GE2D_GEHBDW0, data32);
  2039. }
  2040. }
  2041. }
  2042. while ((inpw(REG_GE2D_INTSTS) & 0x01) == 0); // wait for command complete
  2043. outpw(REG_GE2D_INTSTS, 1); // clear interrupt status
  2044. }
  2045. /**
  2046. * @brief Screen-to-Host BitBlt with SRCCOPY (through data port).
  2047. * @param[in] x x position
  2048. * @param[in] y y position
  2049. * @param[in] width is display width
  2050. * @param[in] height is display height
  2051. * @param[in] buf is pointer of HostBLT data
  2052. * @return none
  2053. */
  2054. void ge2dHostBlt_Read(int x, int y, int width, int height, void *buf)
  2055. {
  2056. UINT32 cmd32, dest_pitch, dest_start, dest_dimension;
  2057. int transfer_count, i, j;
  2058. UINT32 *ptr32;
  2059. #ifdef DEBUG
  2060. sysprintf("host_read_blt()\n");
  2061. sysprintf("(%d,%d)-(%d,%d)\n", x, y, x + width - 1, y + height - 1);
  2062. sysprintf("width=%d height=%d\n", width, height);
  2063. #endif
  2064. cmd32 = 0xcc430001;
  2065. outpw(REG_GE2D_CTL, cmd32);
  2066. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  2067. outpw(REG_GE2D_SDPITCH, dest_pitch);
  2068. dest_start = y << 16 | x;
  2069. outpw(REG_GE2D_DSTSPA, dest_start);
  2070. dest_dimension = height << 16 | width;
  2071. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2072. outpw(REG_GE2D_TRG, 1);
  2073. ptr32 = (UINT32 *)buf;
  2074. for (i = 0; i < height; i++)
  2075. {
  2076. transfer_count = (width * (GFX_BPP / 8) + 3) / 4; // 4-byte count
  2077. while (transfer_count >= 8)
  2078. {
  2079. while ((inpw(REG_GE2D_MISCTL) & 0x00000400) == 0);
  2080. for (j = 0; j < 8; j++)
  2081. {
  2082. *ptr32++ = inpw(REG_GE2D_GEHBDW0);
  2083. }
  2084. transfer_count -= 8;
  2085. }
  2086. if (transfer_count > 0)
  2087. {
  2088. while (((inpw(REG_GE2D_MISCTL) & 0x0000f000) >> 12) != transfer_count);
  2089. for (j = 0; j < transfer_count; j++)
  2090. {
  2091. *ptr32++ = inpw(REG_GE2D_GEHBDW0);
  2092. }
  2093. }
  2094. }
  2095. while ((inpw(REG_GE2D_INTSTS) & 0x01) == 0); // wait for command complete
  2096. outpw(REG_GE2D_INTSTS, 1); // clear interrupt status
  2097. }
  2098. /**
  2099. * @brief Host-to-Screen SpriteBlt with SRCCOPY.
  2100. * @param[in] x x position
  2101. * @param[in] y y position
  2102. * @param[in] width is display width
  2103. * @param[in] height is display height
  2104. * @param[in] buf is pointer of HostBLT data
  2105. * @return none
  2106. */
  2107. void ge2dHostBlt_Sprite(int x, int y, int width, int height, void *buf)
  2108. {
  2109. UINT32 cmd32, dest_pitch, dest_start, dest_dimension;
  2110. int transfer_count, i, j;
  2111. UINT32 *ptr32, data32, alpha;
  2112. #ifdef DEBUG
  2113. sysprintf("host_sprite_blt()\n");
  2114. sysprintf("(%d,%d)-(%d,%d)\n", x, y, x + width - 1, y + height - 1);
  2115. #endif
  2116. cmd32 = 0xcc430020;
  2117. outpw(REG_GE2D_CTL, cmd32);
  2118. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  2119. outpw(REG_GE2D_SDPITCH, dest_pitch);
  2120. dest_start = y << 16 | x;
  2121. outpw(REG_GE2D_DSTSPA, dest_start);
  2122. dest_dimension = height << 16 | width;
  2123. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2124. if (_ClipEnable)
  2125. {
  2126. cmd32 |= 0x00000200;
  2127. if (_OutsideClip)
  2128. {
  2129. cmd32 |= 0x00000100;
  2130. }
  2131. outpw(REG_GE2D_CTL, cmd32);
  2132. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2133. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2134. }
  2135. if (_DrawMode == MODE_TRANSPARENT)
  2136. {
  2137. cmd32 |= 0x00008000; // color transparency
  2138. outpw(REG_GE2D_CTL, cmd32);
  2139. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2140. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2141. }
  2142. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  2143. {
  2144. cmd32 |= 0x00009000;
  2145. outpw(REG_GE2D_CTL, cmd32);
  2146. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2147. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2148. }
  2149. if (_EnableAlpha)
  2150. {
  2151. cmd32 |= 0x00200000;
  2152. outpw(REG_GE2D_CTL, cmd32);
  2153. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  2154. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  2155. data32 |= (alpha << 16);
  2156. outpw(REG_GE2D_MISCTL, data32);
  2157. }
  2158. outpw(REG_GE2D_TRG, 1);
  2159. ptr32 = (UINT32 *)buf;
  2160. for (i = 0; i < height; i++)
  2161. {
  2162. transfer_count = width * (GFX_BPP / 8) / 4; // 4-byte count
  2163. while (transfer_count > 8)
  2164. {
  2165. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2166. for (j = 0; j < 8; j++)
  2167. {
  2168. data32 = *ptr32++;
  2169. outpw(REG_GE2D_GEHBDW0, data32);
  2170. }
  2171. transfer_count -= 8;
  2172. }
  2173. if (transfer_count > 0)
  2174. {
  2175. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2176. for (j = 0; j < transfer_count; j++)
  2177. {
  2178. data32 = *ptr32++;
  2179. outpw(REG_GE2D_GEHBDW0, data32);
  2180. }
  2181. }
  2182. }
  2183. NU_GE2D_COND_WAIT();
  2184. NU_GE2D_UNLOCK();
  2185. }
  2186. /**
  2187. * @brief Captured the specified photo data from display memory, then displayed on display memory by rotation angle
  2188. * @param[in] srcx source x position
  2189. * @param[in] srcy source y position
  2190. * @param[in] destx destination x position
  2191. * @param[in] desty destination y position
  2192. * @param[in] width is display width
  2193. * @param[in] height is display height
  2194. * @param[in] ctl is drawing direction
  2195. * @return none
  2196. */
  2197. void ge2dRotation(int srcx, int srcy, int destx, int desty, int width, int height, int ctl)
  2198. {
  2199. UINT32 cmd32, dest_start, src_start, dimension, pitch;
  2200. void *tmpscreen, *orig_dest_start00;
  2201. tmpscreen = (void *)rt_malloc(width * height * GFX_BPP / 8);
  2202. #ifdef DEBUG
  2203. sysprintf("rotation_image()\n");
  2204. sysprintf("(%d,%d)=>(%d,%d)\n", srcx, srcy, destx, desty);
  2205. sysprintf("width=%d height=%d\n", width, height);
  2206. #endif
  2207. rt_memset(tmpscreen, 0, width * height * GFX_BPP / 8);
  2208. orig_dest_start00 = (void *)inpw(REG_GE2D_XYDORG);
  2209. outpw(REG_GE2D_XYDORG, (int)tmpscreen); //captured photo to another position
  2210. outpw(REG_GE2D_XYSORG, (int)GFX_START_ADDR);
  2211. ge2dBitblt_SourceToDestination(srcx, srcy, 0, 0, width, height, GFX_WIDTH, width);
  2212. src_start = dest_start = dimension = cmd32 = pitch = 0;
  2213. outpw(REG_GE2D_XYDORG, (int)orig_dest_start00);
  2214. outpw(REG_GE2D_XYSORG, (int)tmpscreen);
  2215. pitch = GFX_WIDTH << 16 | width;
  2216. outpw(REG_GE2D_SDPITCH, pitch);
  2217. src_start = 0 << 16 | 0; // captured photo at (0,0) position
  2218. outpw(REG_GE2D_SRCSPA, src_start);
  2219. dest_start = desty << 16 | destx;
  2220. outpw(REG_GE2D_DSTSPA, dest_start);
  2221. dimension = height << 16 | width;
  2222. outpw(REG_GE2D_RTGLSZ, dimension);
  2223. cmd32 = 0xcc030000 | (ctl << 1);
  2224. if (_ClipEnable)
  2225. {
  2226. cmd32 |= 0x00000200;
  2227. if (_OutsideClip)
  2228. {
  2229. cmd32 |= 0x00000100;
  2230. }
  2231. outpw(REG_GE2D_CTL, cmd32);
  2232. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2233. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2234. }
  2235. /* set rotation reference point xy register, then nothing happened */
  2236. outpw(REG_GE2D_CTL, cmd32);
  2237. outpw(REG_GE2D_TRG, 1);
  2238. NU_GE2D_COND_WAIT();
  2239. rt_free(tmpscreen);
  2240. NU_GE2D_UNLOCK();
  2241. }
  2242. /**
  2243. * @brief OffScreen-to-OnScreen SpriteBlt with SRCCOPY.
  2244. * @param[in] destx destination x position
  2245. * @param[in] desty destination y position
  2246. * @param[in] sprite_width is sprite width
  2247. * @param[in] sprite_height is sprite height
  2248. * @param[in] buf is pointer of origin data
  2249. * @return none
  2250. */
  2251. void ge2dSpriteBlt_Screen(int destx, int desty, int sprite_width, int sprite_height, void *buf)
  2252. {
  2253. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  2254. UINT32 data32, alpha;
  2255. #ifdef DEBUG
  2256. sysprintf("screen_sprite_blt():\n");
  2257. sysprintf("buf=%08x, x=%d y=%d width=%d height=%d\n", buf, destx, desty, sprite_width, sprite_height);
  2258. #endif
  2259. cmd32 = 0xcc430000;
  2260. outpw(REG_GE2D_CTL, cmd32);
  2261. pitch = GFX_WIDTH << 16 | sprite_width; // pitch in pixel
  2262. outpw(REG_GE2D_SDPITCH, pitch);
  2263. src_start = 0; // start from (0,0) of sprite
  2264. outpw(REG_GE2D_SRCSPA, src_start);
  2265. dest_start = desty << 16 | destx;
  2266. outpw(REG_GE2D_DSTSPA, dest_start);
  2267. dimension = sprite_height << 16 | sprite_width;
  2268. outpw(REG_GE2D_RTGLSZ, dimension);
  2269. outpw(REG_GE2D_XYSORG, (UINT32)buf);
  2270. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  2271. if (_ClipEnable)
  2272. {
  2273. cmd32 |= 0x00000200;
  2274. if (_OutsideClip)
  2275. {
  2276. cmd32 |= 0x00000100;
  2277. }
  2278. outpw(REG_GE2D_CTL, cmd32);
  2279. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2280. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2281. }
  2282. if (_DrawMode == MODE_TRANSPARENT)
  2283. {
  2284. cmd32 |= 0x00008000; // color transparency
  2285. outpw(REG_GE2D_CTL, cmd32);
  2286. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2287. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2288. }
  2289. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  2290. {
  2291. cmd32 |= 0x00009000; // destination pixels control transparency
  2292. outpw(REG_GE2D_CTL, cmd32);
  2293. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2294. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2295. }
  2296. if (_EnableAlpha)
  2297. {
  2298. cmd32 |= 0x00200000;
  2299. outpw(REG_GE2D_CTL, cmd32);
  2300. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  2301. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  2302. data32 |= (alpha << 16);
  2303. outpw(REG_GE2D_MISCTL, data32);
  2304. }
  2305. outpw(REG_GE2D_CTL, cmd32);
  2306. outpw(REG_GE2D_TRG, 1);
  2307. NU_GE2D_COND_WAIT();
  2308. NU_GE2D_UNLOCK();
  2309. }
  2310. /**
  2311. * @brief OffScreen-to-OnScreen SpriteBlt with SRCCOPY.
  2312. * @param[in] x x position
  2313. * @param[in] y y position
  2314. * @param[in] sprite_sx sprite x position
  2315. * @param[in] sprite_sy sprite y position
  2316. * @param[in] width is width
  2317. * @param[in] height is height
  2318. * @param[in] sprite_width is sprite width
  2319. * @param[in] sprite_height is sprite height
  2320. * @param[in] buf is pointer of origin data
  2321. * @return none
  2322. * @note The sprite starting address can be programmed.
  2323. */
  2324. void ge2dSpriteBltx_Screen(int x, int y, int sprite_sx, int sprite_sy, int width, int height, int sprite_width, int sprite_height, void *buf)
  2325. {
  2326. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  2327. UINT32 data32, alpha;
  2328. #ifdef DEBUG
  2329. sysprintf("screen_sprite_bltx(): (%d,%d)\n", x, y);
  2330. sysprintf("sprite width=%d height=%d\n", sprite_width, sprite_height);
  2331. sysprintf("x=%d y=%d width=%d height=%d\n", sprite_sx, sprite_sy, width, height);
  2332. #endif
  2333. cmd32 = 0xcc430000;
  2334. outpw(REG_GE2D_CTL, cmd32);
  2335. pitch = GFX_WIDTH << 16 | sprite_width; // pitch in pixel
  2336. outpw(REG_GE2D_SDPITCH, pitch);
  2337. outpw(REG_GE2D_XYSORG, (UINT32)buf);
  2338. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR);
  2339. src_start = sprite_sy << 16 | sprite_sx;
  2340. outpw(REG_GE2D_SRCSPA, src_start);
  2341. dest_start = y << 16 | x;
  2342. outpw(REG_GE2D_DSTSPA, dest_start);
  2343. dimension = height << 16 | width;
  2344. outpw(REG_GE2D_RTGLSZ, dimension);
  2345. if (_ClipEnable)
  2346. {
  2347. cmd32 |= 0x00000200;
  2348. if (_OutsideClip)
  2349. {
  2350. cmd32 |= 0x00000100;
  2351. }
  2352. outpw(REG_GE2D_CTL, cmd32);
  2353. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2354. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2355. }
  2356. if (_DrawMode == MODE_TRANSPARENT)
  2357. {
  2358. cmd32 |= 0x00008000; // color transparency
  2359. outpw(REG_GE2D_CTL, cmd32);
  2360. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2361. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2362. }
  2363. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  2364. {
  2365. cmd32 |= 0x00009000; // destination pixels control transparency
  2366. outpw(REG_GE2D_CTL, cmd32);
  2367. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2368. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2369. }
  2370. if (_EnableAlpha)
  2371. {
  2372. cmd32 |= 0x00200000;
  2373. outpw(REG_GE2D_CTL, cmd32);
  2374. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  2375. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  2376. data32 |= (alpha << 16);
  2377. outpw(REG_GE2D_MISCTL, data32);
  2378. }
  2379. outpw(REG_GE2D_TRG, 1);
  2380. NU_GE2D_COND_WAIT();
  2381. NU_GE2D_UNLOCK();
  2382. }
  2383. /**
  2384. * @brief OffScreen-to-OnScreen SpriteBlt with ROP.
  2385. * @param[in] x x position
  2386. * @param[in] y y position
  2387. * @param[in] sprite_width is sprite width
  2388. * @param[in] sprite_height is sprite height
  2389. * @param[in] buf is pointer of origin data
  2390. * @param[in] rop is ROP operation code
  2391. * @return none
  2392. * @note The sprite always starts from (0,0) for the BLT.
  2393. */
  2394. void ge2dSpriteBlt_ScreenRop(int x, int y, int sprite_width, int sprite_height, void *buf, int rop)
  2395. {
  2396. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  2397. UINT32 data32, alpha;
  2398. #ifdef DEBUG
  2399. sysprintf("screen_sprite_rop_blt():\n");
  2400. sysprintf("x=%d y=%d width=%d height=%d\n", x, y, sprite_width, sprite_height);
  2401. sysprintf("rop=0x%x\n", rop);
  2402. #endif
  2403. cmd32 = 0x00430000 | (rop << 24);
  2404. if (_PatternType == TYPE_MONO)
  2405. {
  2406. cmd32 |= 0x00000010; // default is TYPE_COLOR
  2407. }
  2408. outpw(REG_GE2D_CTL, cmd32);
  2409. pitch = GFX_WIDTH << 16 | sprite_width; // pitch in pixel
  2410. outpw(REG_GE2D_SDPITCH, pitch);
  2411. src_start = 0; // start from (0,0) of sprite
  2412. outpw(REG_GE2D_SRCSPA, src_start);
  2413. dest_start = y << 16 | x;
  2414. outpw(REG_GE2D_DSTSPA, dest_start);
  2415. dimension = sprite_height << 16 | sprite_width;
  2416. outpw(REG_GE2D_RTGLSZ, dimension);
  2417. outpw(REG_GE2D_XYSORG, (UINT32)buf);
  2418. outpw(REG_GE2D_XYDORG, (int) GFX_START_ADDR); //smf
  2419. if (_ClipEnable)
  2420. {
  2421. cmd32 |= 0x00000200;
  2422. if (_OutsideClip)
  2423. {
  2424. cmd32 |= 0x00000100;
  2425. }
  2426. outpw(REG_GE2D_CTL, cmd32);
  2427. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2428. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2429. }
  2430. if (_DrawMode == MODE_TRANSPARENT)
  2431. {
  2432. cmd32 |= 0x00008000; // color transparency
  2433. outpw(REG_GE2D_CTL, cmd32);
  2434. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2435. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2436. }
  2437. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  2438. {
  2439. cmd32 |= 0x00009000; // destination pixels control transparency
  2440. outpw(REG_GE2D_CTL, cmd32);
  2441. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2442. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2443. }
  2444. if (_EnableAlpha)
  2445. {
  2446. cmd32 |= 0x00200000;
  2447. outpw(REG_GE2D_CTL, cmd32);
  2448. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  2449. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  2450. data32 |= (alpha << 16);
  2451. outpw(REG_GE2D_MISCTL, data32);
  2452. }
  2453. if ((rop == 0x00) || (rop == 0xff))
  2454. {
  2455. cmd32 = (cmd32 & 0xffff0fff) | 0x00009000;
  2456. outpw(REG_GE2D_CTL, cmd32);
  2457. }
  2458. outpw(REG_GE2D_TRG, 1);
  2459. NU_GE2D_COND_WAIT();
  2460. NU_GE2D_UNLOCK();
  2461. }
  2462. /**
  2463. * @brief OffScreen-to-OnScreen SpriteBlt with ROP.
  2464. * @param[in] x x position
  2465. * @param[in] y y position
  2466. * @param[in] sprite_sx sprite x position
  2467. * @param[in] sprite_sy sprite y position
  2468. * @param[in] width is width
  2469. * @param[in] height is height
  2470. * @param[in] sprite_width is sprite width
  2471. * @param[in] sprite_height is sprite height
  2472. * @param[in] buf is pointer of origin data
  2473. * @param[in] rop is ROP operation code
  2474. * @return none
  2475. * @note The sprite always starts from (0,0) for the BLT.
  2476. */
  2477. void ge2dSpriteBltx_ScreenRop(int x, int y, int sprite_sx, int sprite_sy, int width, int height, int sprite_width, int sprite_height, void *buf, int rop)
  2478. {
  2479. UINT32 cmd32, pitch, dest_start, src_start, dimension;
  2480. UINT32 data32, alpha;
  2481. #ifdef DEBUG
  2482. sysprintf("screen_sprite_rop_bltx():\n");
  2483. sysprintf("x=%d y=%d width=%d height=%d\n", x, y, sprite_width, sprite_height);
  2484. sysprintf("rop=0x%x\n", rop);
  2485. #endif
  2486. cmd32 = 0x00430000 | (rop << 24);
  2487. if (_PatternType == TYPE_MONO)
  2488. {
  2489. cmd32 |= 0x00000010; // default is TYPE_COLOR
  2490. }
  2491. outpw(REG_GE2D_CTL, cmd32);
  2492. pitch = GFX_WIDTH << 16 | sprite_width; // pitch in pixel
  2493. outpw(REG_GE2D_SDPITCH, pitch);
  2494. src_start = sprite_sy << 16 | sprite_sx;
  2495. outpw(REG_GE2D_SRCSPA, src_start);
  2496. dest_start = y << 16 | x;
  2497. outpw(REG_GE2D_DSTSPA, dest_start);
  2498. dimension = height << 16 | width;
  2499. outpw(REG_GE2D_RTGLSZ, dimension);
  2500. outpw(REG_GE2D_XYSORG, (UINT32)buf);
  2501. outpw(REG_GE2D_XYDORG, (int)GFX_START_ADDR); //smf
  2502. if (_ClipEnable)
  2503. {
  2504. cmd32 |= 0x00000200;
  2505. if (_OutsideClip)
  2506. {
  2507. cmd32 |= 0x00000100;
  2508. }
  2509. outpw(REG_GE2D_CTL, cmd32);
  2510. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2511. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2512. }
  2513. if (_DrawMode == MODE_TRANSPARENT)
  2514. {
  2515. cmd32 |= 0x00008000; // color transparency
  2516. outpw(REG_GE2D_CTL, cmd32);
  2517. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2518. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2519. }
  2520. else if (_DrawMode == MODE_DEST_TRANSPARENT)
  2521. {
  2522. cmd32 |= 0x00009000; // destination pixels control transparency
  2523. outpw(REG_GE2D_CTL, cmd32);
  2524. outpw(REG_GE2D_TRNSCOLR, _ColorKey);
  2525. outpw(REG_GE2D_TCMSK, _ColorKeyMask);
  2526. }
  2527. if (_EnableAlpha)
  2528. {
  2529. cmd32 |= 0x00200000;
  2530. outpw(REG_GE2D_CTL, cmd32);
  2531. data32 = inpw(REG_GE2D_MISCTL) & 0x0000ffff;
  2532. alpha = (UINT32)((_AlphaKs << 8) | _AlphaKd);
  2533. data32 |= (alpha << 16);
  2534. outpw(REG_GE2D_MISCTL, data32);
  2535. }
  2536. if ((rop == 0x00) || (rop == 0xff))
  2537. {
  2538. cmd32 = (cmd32 & 0xffff0fff) | 0x00009000;
  2539. outpw(REG_GE2D_CTL, cmd32);
  2540. }
  2541. outpw(REG_GE2D_TRG, 1);
  2542. NU_GE2D_COND_WAIT();
  2543. NU_GE2D_UNLOCK();
  2544. }
  2545. /**
  2546. * @brief OffScreen-to-OnScreen TextBLT.
  2547. * @param[in] x x position
  2548. * @param[in] y y position
  2549. * @param[in] width is width
  2550. * @param[in] height is height
  2551. * @param[in] fore_color is color of foreground
  2552. * @param[in] back_color is color of background
  2553. * @param[in] opt is transparent is enable or not
  2554. * @param[in] buf is pointer of origin data
  2555. * @return none
  2556. * @note Fetch the monochrome source data from off-screen memory to the desired destination area
  2557. */
  2558. void ge2dColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf)
  2559. {
  2560. UINT32 cmd32, dest_pitch, src_pitch, pitch, dest_start, dest_dimension;
  2561. UINT32 fore_color32, back_color32;
  2562. fore_color32 = make_color(fore_color);
  2563. back_color32 = make_color(back_color);
  2564. cmd32 = 0xcc430080;
  2565. if (opt == MODE_TRANSPARENT)
  2566. {
  2567. cmd32 |= 0x00004000; // mono transparency
  2568. }
  2569. outpw(REG_GE2D_CTL, cmd32);
  2570. outpw(REG_GE2D_FGCOLR, fore_color32);
  2571. outpw(REG_GE2D_BGCOLR, back_color32);
  2572. dest_pitch = GFX_WIDTH; // pitch in pixels
  2573. src_pitch = width; // pitch in pixels
  2574. pitch = (dest_pitch << 16) | src_pitch;
  2575. outpw(REG_GE2D_SDPITCH, pitch);
  2576. outpw(REG_GE2D_XYSORG, (int)buf);
  2577. outpw(REG_GE2D_SRCSPA, 0); // always start from (0,0)
  2578. dest_start = y << 16 | x;
  2579. outpw(REG_GE2D_DSTSPA, dest_start);
  2580. dest_dimension = height << 16 | width;
  2581. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2582. if (_ClipEnable)
  2583. {
  2584. cmd32 |= 0x00000200;
  2585. if (_OutsideClip)
  2586. {
  2587. cmd32 |= 0x00000100;
  2588. }
  2589. outpw(REG_GE2D_CTL, cmd32);
  2590. outpw(REG_GE2D_CLPBTL, _ClipTL);
  2591. outpw(REG_GE2D_CLPBBR, _ClipBR);
  2592. }
  2593. outpw(REG_GE2D_TRG, 1);
  2594. NU_GE2D_COND_WAIT();
  2595. NU_GE2D_UNLOCK();
  2596. }
  2597. /**
  2598. * @brief Host-to-Screen TextBLT through data port.
  2599. * @param[in] x x position
  2600. * @param[in] y y position
  2601. * @param[in] width is width
  2602. * @param[in] height is height
  2603. * @param[in] fore_color is color of foreground
  2604. * @param[in] back_color is color of background
  2605. * @param[in] opt is transparent is enable or not
  2606. * @param[in] buf is pointer of origin data
  2607. * @return none
  2608. */
  2609. void ge2dHostColorExpansionBlt(int x, int y, int width, int height, int fore_color, int back_color, int opt, void *buf)
  2610. {
  2611. UINT32 cmd32, dest_pitch, dest_start, dest_dimension;
  2612. UINT32 fore_color32, back_color32;
  2613. UINT32 *ptr32, data32;
  2614. int transfer_count, i, j;
  2615. fore_color32 = make_color(fore_color);
  2616. back_color32 = make_color(back_color);
  2617. cmd32 = 0xcc4300a0;
  2618. if (opt == MODE_TRANSPARENT)
  2619. {
  2620. cmd32 |= 0x00004000; // mono transparency
  2621. }
  2622. outpw(REG_GE2D_CTL, cmd32);
  2623. outpw(REG_GE2D_FGCOLR, fore_color32);
  2624. outpw(REG_GE2D_BGCOLR, back_color32);
  2625. dest_pitch = GFX_WIDTH << 16; // pitch in pixel
  2626. outpw(REG_GE2D_SDPITCH, dest_pitch);
  2627. dest_start = y << 16 | x;
  2628. outpw(REG_GE2D_DSTSPA, dest_start);
  2629. outpw(REG_GE2D_SRCSPA, dest_start);
  2630. dest_dimension = height << 16 | width;
  2631. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2632. outpw(REG_GE2D_TRG, 1);
  2633. ptr32 = (UINT32 *)buf;
  2634. for (i = 0; i < height; i++)
  2635. {
  2636. transfer_count = (width + 31) / 32; // 32 pixels unit
  2637. while (transfer_count > 8)
  2638. {
  2639. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2640. for (j = 0; j < 8; j++)
  2641. {
  2642. data32 = *ptr32++;
  2643. outpw(REG_GE2D_GEHBDW0, data32);
  2644. }
  2645. transfer_count -= 8;
  2646. }
  2647. if (transfer_count > 0)
  2648. {
  2649. while ((inpw(REG_GE2D_MISCTL) & 0x00000800) == 0); // check empty
  2650. for (j = 0; j < transfer_count; j++)
  2651. {
  2652. data32 = *ptr32++;
  2653. outpw(REG_GE2D_GEHBDW0, data32);
  2654. }
  2655. }
  2656. }
  2657. NU_GE2D_COND_WAIT();
  2658. NU_GE2D_UNLOCK();
  2659. }
  2660. /**
  2661. * @brief Set the 8x8 mono pattern for following BitBLT functions.
  2662. * @param[in] opt is index for build-in pattern
  2663. * @param[in] fore_color is color of foreground
  2664. * @param[in] back_color is color of background
  2665. * @return none
  2666. */
  2667. void ge2dInitMonoPattern(int opt, int fore_color, int back_color)
  2668. {
  2669. UINT32 color32;
  2670. /*
  2671. ** If hardware pattern definition is a little different from software.
  2672. ** Need to do the BYTE swap before programming the pattern registers.
  2673. */
  2674. outpw(REG_GE2D_PTNA, MonoPatternData[opt].PatternA);
  2675. outpw(REG_GE2D_PTNB, MonoPatternData[opt].PatternB);
  2676. color32 = make_color(fore_color);
  2677. outpw(REG_GE2D_FGCOLR, color32);
  2678. color32 = make_color(back_color);
  2679. outpw(REG_GE2D_BGCOLR, color32);
  2680. _PatternType = TYPE_MONO;
  2681. }
  2682. /**
  2683. * @brief Set the 8x8 mono pattern for following BitBLT functions.
  2684. * @param[in] PatternA is pattern A
  2685. * @param[in] PatternB is pattern B
  2686. * @param[in] fore_color is color of foreground
  2687. * @param[in] back_color is color of background
  2688. * @return none
  2689. */
  2690. void ge2dInitMonoInputPattern(UINT32 PatternA, UINT32 PatternB, int fore_color, int back_color)
  2691. {
  2692. UINT32 color32;
  2693. /*
  2694. ** If hardware pattern definition is a little different from software.
  2695. ** Need to do the BYTE swap before programming the pattern registers.
  2696. */
  2697. outpw(REG_GE2D_PTNA, PatternA);
  2698. outpw(REG_GE2D_PTNB, PatternB);
  2699. color32 = make_color(fore_color);
  2700. outpw(REG_GE2D_FGCOLR, color32);
  2701. color32 = make_color(back_color);
  2702. outpw(REG_GE2D_BGCOLR, color32);
  2703. _PatternType = TYPE_MONO;
  2704. }
  2705. /**
  2706. * @brief Set the 8x8 color pattern for following BitBLT functions.
  2707. * @param[in] patformat is format of pattern, value could be
  2708. * - \ref RGB888
  2709. * - \ref RGB565
  2710. * - \ref RGB332
  2711. * @param[in] patdata is pointer of input pattern image
  2712. * @return none
  2713. * @note This function transfers those forms:
  2714. * RGB888 to RGB565 or RGB332
  2715. * RGB565 to RGB332 or RGB888
  2716. * RGB332 to RGB565 or RGB888
  2717. */
  2718. void ge2dInitColorPattern(int patformat, void *patdata)
  2719. {
  2720. UINT8 *ptr_pat;
  2721. UINT8 *ptr8, r8, g8, b8;
  2722. UINT16 *ptr16, r16, g16, b16, g16_1, g16_2;
  2723. UINT32 *ptr32, r32, g32, b32, g32_1, g32_2;
  2724. int idx;
  2725. ptr_pat = (UINT8 *)patdata;
  2726. if (patformat == RGB888)
  2727. {
  2728. if (GFX_BPP == 8)
  2729. {
  2730. ptr8 = (UINT8 *)GFX_PAT_ADDR;
  2731. for (idx = 0; idx < 64; idx++)
  2732. {
  2733. b8 = (UINT8)(*ptr_pat++) & 0xc0; // 2 bits
  2734. g8 = (UINT8)(*ptr_pat++) & 0xe0; // 3 bits
  2735. r8 = (UINT8)(*ptr_pat++) & 0xe0; // 3 bits
  2736. ptr_pat++;
  2737. *ptr8++ = r8 | (g8 >> 3) | (b8 >> 6);
  2738. }
  2739. }
  2740. else if (GFX_BPP == 16)
  2741. {
  2742. ptr16 = (UINT16 *)GFX_PAT_ADDR;
  2743. for (idx = 0; idx < 64; idx++)
  2744. {
  2745. b16 = (UINT16)(*ptr_pat++) & 0x000f8; // 5 bits
  2746. g16 = (UINT16)(*ptr_pat++) & 0x000fc; // 6 bits
  2747. r16 = (UINT16)(*ptr_pat++) & 0x000f8; // 5 bits
  2748. ptr_pat++;
  2749. *ptr16++ = (r16 << 8) | (g16 << 3) | (b16 >> 3);
  2750. }
  2751. }
  2752. else if (GFX_BPP == 32)
  2753. {
  2754. ptr32 = (UINT32 *)GFX_PAT_ADDR;
  2755. for (idx = 0; idx < 64; idx++)
  2756. {
  2757. b32 = (UINT32)(*ptr_pat++);
  2758. g32 = (UINT32)(*ptr_pat++);
  2759. r32 = (UINT32)(*ptr_pat++);
  2760. ptr_pat++;
  2761. *ptr32++ = (r32 << 16) | (g32 << 8) | b32;
  2762. }
  2763. }
  2764. }
  2765. else if (patformat == RGB565)
  2766. {
  2767. if (GFX_BPP == 8)
  2768. {
  2769. ptr8 = (UINT8 *)GFX_PAT_ADDR;
  2770. for (idx = 0; idx < 64; idx++)
  2771. {
  2772. b8 = (UINT8)(*ptr_pat++) & 0x00018; // 2 bits
  2773. g8 = (UINT8)(*ptr_pat) & 0x00007; // 3 bits
  2774. r8 = (UINT8)(*ptr_pat++) & 0x000e0; // 3bits
  2775. *ptr8++ = r8 | (g8 << 2) | (b8 >> 3);
  2776. }
  2777. }
  2778. else if (GFX_BPP == 16)
  2779. {
  2780. ptr16 = (UINT16 *)GFX_PAT_ADDR;
  2781. for (idx = 0; idx < 64; idx++)
  2782. {
  2783. *ptr16++ = (*ptr_pat) | (*(ptr_pat + 1)) << 8;
  2784. ptr_pat += 2;
  2785. }
  2786. }
  2787. else if (GFX_BPP == 32)
  2788. {
  2789. ptr32 = (UINT32 *)GFX_PAT_ADDR;
  2790. for (idx = 0; idx < 64; idx++)
  2791. {
  2792. b32 = (UINT8)(*ptr_pat) & 0x1f; // 5 bits
  2793. g32_1 = (UINT8)(*ptr_pat++) & 0xe0; // front 3 bits
  2794. g32_2 = (UINT8)(*ptr_pat) & 0x07; // back 3 bits
  2795. g32 = ((g32_1 >> 5) | (g32_2 << 3)) << 2;
  2796. r32 = (UINT8)(*ptr_pat++) & 0xf8; // 5 bits
  2797. *ptr32++ = 0 << 24 | (r32 << 16) | (g32 << 8) | (b32 << 3);
  2798. }
  2799. }
  2800. }
  2801. else if (patformat == RGB332)
  2802. {
  2803. if (GFX_BPP == 8)
  2804. {
  2805. ptr8 = (UINT8 *)GFX_PAT_ADDR;
  2806. for (idx = 0; idx < 64; idx++)
  2807. {
  2808. *ptr8++ = *ptr_pat;
  2809. ptr_pat++;
  2810. }
  2811. }
  2812. else if (GFX_BPP == 16)
  2813. {
  2814. ptr16 = (UINT16 *)GFX_PAT_ADDR;
  2815. for (idx = 0; idx < 64; idx++)
  2816. {
  2817. r16 = (UINT8)(*ptr_pat) & 0xe0; // 3 bits
  2818. g16_1 = (UINT8)(*ptr_pat) & 0x10;
  2819. g16_2 = (UINT8)(*ptr_pat) & 0x0c;
  2820. g16 = (g16_1 >> 2) | (g16_2 >> 2);
  2821. b16 = (UINT8)(*ptr_pat++) & 0x3; // 2 bits
  2822. *ptr16++ = (r16 << 8) | (g16 << 8) | (b16 << 3);
  2823. }
  2824. }
  2825. else if (GFX_BPP == 32)
  2826. {
  2827. ptr32 = (UINT32 *)GFX_PAT_ADDR;
  2828. for (idx = 0; idx < 64; idx++)
  2829. {
  2830. r32 = (UINT8)(*ptr_pat) & 0xe0; // 3 bits
  2831. g32 = (UINT8)(*ptr_pat) & 0x1c; // 3 bits
  2832. b32 = (UINT8)(*ptr_pat++) & 0x3; // 2 bits
  2833. *ptr32++ = 0 << 24 | (r32 << 15) | (g32 << 11) | (b32 << 6);
  2834. }
  2835. }
  2836. }
  2837. _PatternType = TYPE_COLOR;
  2838. }
  2839. /**
  2840. * @brief Display font character.
  2841. * @param[in] x x position
  2842. * @param[in] y y position
  2843. * @param[in] asc_code is ascii code
  2844. * @param[in] fore_color is color of foreground
  2845. * @param[in] back_color is color of background
  2846. * @param[in] draw_mode is transparent is enable or not
  2847. * @param[in] font_id is selection of 8x8 or 8x16 font
  2848. * @return none
  2849. */
  2850. void ge2dFont_PutChar(int x, int y, char asc_code, int fore_color, int back_color, int draw_mode, int font_id)
  2851. {
  2852. int cmd32, dest_pitch, src_pitch, pitch, dest_start, dest_dimension;
  2853. UINT32 width, height;
  2854. UINT32 fore_color32, back_color32;
  2855. UINT8 *fptr;
  2856. UINT8 *temp_buf[32 * 32], *ptr8;
  2857. int idx;
  2858. fore_color32 = make_color(fore_color);
  2859. back_color32 = make_color(back_color);
  2860. cmd32 = 0xcc430080;
  2861. if (draw_mode == MODE_TRANSPARENT)
  2862. {
  2863. cmd32 |= 0x00004000; // mono transparency
  2864. }
  2865. outpw(REG_GE2D_CTL, cmd32);
  2866. outpw(REG_GE2D_FGCOLR, fore_color32);
  2867. outpw(REG_GE2D_BGCOLR, back_color32);
  2868. if (font_id == F8x16)
  2869. {
  2870. fptr = (UINT8 *)&FontData16[asc_code][0];
  2871. src_pitch = 32;
  2872. width = 32;
  2873. height = 16;
  2874. ptr8 = (UINT8 *)&temp_buf[0];
  2875. for (idx = 0; idx < 16; idx++)
  2876. {
  2877. *ptr8++ = *fptr++;
  2878. *ptr8++ = 0;
  2879. *ptr8++ = 0;
  2880. *ptr8++ = 0;
  2881. }
  2882. fptr = (UINT8 *)&temp_buf[0];
  2883. }
  2884. else /* F8x8 */
  2885. {
  2886. fptr = (UINT8 *)&FontData8[asc_code][0];
  2887. src_pitch = 32;
  2888. width = 32;
  2889. height = 8;
  2890. ptr8 = (UINT8 *)&temp_buf[0];
  2891. for (idx = 0; idx < 8; idx++)
  2892. {
  2893. *ptr8++ = *fptr++;
  2894. *ptr8++ = 0;
  2895. *ptr8++ = 0;
  2896. *ptr8++ = 0;
  2897. }
  2898. fptr = (UINT8 *)&temp_buf[0];
  2899. }
  2900. dest_pitch = GFX_WIDTH; // pitch in pixels
  2901. pitch = (dest_pitch << 16) | src_pitch;
  2902. outpw(REG_GE2D_SDPITCH, pitch);
  2903. outpw(REG_GE2D_XYSORG, (int)fptr);
  2904. outpw(REG_GE2D_SRCSPA, 0); // always start from (0,0)
  2905. dest_start = y << 16 | x;
  2906. outpw(REG_GE2D_DSTSPA, dest_start);
  2907. dest_dimension = height << 16 | width;
  2908. outpw(REG_GE2D_RTGLSZ, dest_dimension);
  2909. outpw(REG_GE2D_TRG, 1);
  2910. NU_GE2D_COND_WAIT();
  2911. NU_GE2D_UNLOCK();
  2912. }
  2913. /**
  2914. * @brief Display font string.
  2915. * @param[in] x x position
  2916. * @param[in] y y position
  2917. * @param[in] str is pointer of display string
  2918. * @param[in] fore_color is color of foreground
  2919. * @param[in] back_color is color of background
  2920. * @param[in] draw_mode is transparent is enable or not
  2921. * @param[in] font_id is selection of 8x8 or 8x16 font
  2922. * @return none
  2923. */
  2924. void ge2dFont_PutString(int x, int y, char *str, int fore_color, int back_color, int draw_mode, int font_id)
  2925. {
  2926. char *ptr;
  2927. int idx, sx;
  2928. ptr = str;
  2929. sx = x;
  2930. for (idx = 0; idx < rt_strlen(str); idx++)
  2931. {
  2932. ge2dFont_PutChar(sx, y, *ptr++, fore_color, back_color, draw_mode, font_id);
  2933. sx += 8; //char width
  2934. }
  2935. }
  2936. /**
  2937. * Hardware GE2D Initialization
  2938. */
  2939. int rt_hw_ge2d_init(void)
  2940. {
  2941. g_sNuGe2d.lock = rt_mutex_create("ge2d_lock", RT_IPC_FLAG_PRIO);
  2942. RT_ASSERT(g_sNuGe2d.lock != RT_NULL);
  2943. #if defined(DEF_COND_WAIT)
  2944. rt_kprintf("with_cond_wait\n");
  2945. g_sNuGe2d.signal = rt_sem_create("ge2d_wait", 0, RT_IPC_FLAG_FIFO);
  2946. RT_ASSERT(g_sNuGe2d.signal != RT_NULL);
  2947. /* Install ISR & Respond the IRQ */
  2948. rt_hw_interrupt_install(g_sNuGe2d.irqn, nu_ge2d_isr, &g_sNuGe2d, g_sNuGe2d.name);
  2949. rt_hw_interrupt_umask(g_sNuGe2d.irqn);
  2950. #endif
  2951. /* Enable GE2D engine clock */
  2952. nu_sys_ipclk_enable(GE2DCKEN);
  2953. return 0;
  2954. }
  2955. INIT_DEVICE_EXPORT(rt_hw_ge2d_init);