drv_ge2d.c 118 KB

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