-
Notifications
You must be signed in to change notification settings - Fork 5
/
App_Common.cpp
901 lines (815 loc) · 42.2 KB
/
App_Common.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
/*
Copyright (c) Bridgetek Pte Ltd
Copyright (c) Riverdi Sp. z o.o. sp. k.
Copyright (c) Lukasz Skalski <[email protected]>
THIS SOFTWARE IS PROVIDED BY BRIDGETEK PTE LTD "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
BRIDGETEK PTE LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BRIDGETEK DRIVERS MAY BE USED ONLY IN CONJUNCTION WITH PRODUCTS BASED ON BRIDGETEK PARTS.
BRIDGETEK DRIVERS MAY BE DISTRIBUTED IN ANY FORM AS LONG AS LICENSE INFORMATION IS NOT MODIFIED.
IF A CUSTOM VENDOR ID AND/OR PRODUCT ID OR DESCRIPTION STRING ARE USED, IT IS THE
RESPONSIBILITY OF THE PRODUCT MANUFACTURER TO MAINTAIN ANY CHANGES AND SUBSEQUENT WHQL
RE-CERTIFICATION AS A RESULT OF MAKING THESE CHANGES.
Abstract:
Application to demonstrate function of EVE.
Author : Bridgetek
Revision History:
0.1 - date 2017.03.24 - Initial version
*/
#include "Platform.h"
#include "App_Common.h"
/*************************************************************************************************
* These functions work with FT8XX GPU buffer
**************************************************************************************************/
uint32_t CmdBuffer_Index;
volatile uint32_t DlBuffer_Index;
#ifdef BUFFER_OPTIMIZATION
uint8_t DlBuffer[DL_SIZE];
uint8_t CmdBuffer[CMD_FIFO_SIZE];
#endif
void App_WrCoCmd_Buffer(Gpu_Hal_Context_t *phost,uint32_t cmd)
{
#ifdef BUFFER_OPTIMIZATION
/* Copy the command instruction into buffer */
uint32_t *pBuffcmd;
/* Prevent buffer overflow */
if (CmdBuffer_Index >= CMD_FIFO_SIZE)
{
//printf("CmdBuffer overflow\n");
if (CmdBuffer_Index > 0) {
Gpu_Hal_WrCmdBuf_nowait(phost, CmdBuffer, CmdBuffer_Index);
}
CmdBuffer_Index = 0;
}
pBuffcmd = (uint32_t*)&CmdBuffer[CmdBuffer_Index];
*pBuffcmd = cmd;
#endif
#if defined (STM32_PLATFORM) || defined (ARDUINO_PLATFORM)
Gpu_Hal_WrCmd32(phost,cmd);
#endif
/* Increment the command index */
CmdBuffer_Index += CMD_SIZE;
}
void App_WrDl_Buffer(Gpu_Hal_Context_t *phost,uint32_t cmd)
{
#ifdef BUFFER_OPTIMIZATION
/* Copy the command instruction into buffer */
uint32_t *pBuffcmd;
/* Prevent buffer overflow */
if (DlBuffer_Index < DL_SIZE)
{
pBuffcmd = (uint32_t*)&DlBuffer[DlBuffer_Index];
*pBuffcmd = cmd;
}
else
{
printf("DlBuffer overflow\n");
}
#endif
#if defined (STM32_PLATFORM) || defined (ARDUINO_PLATFORM)
Gpu_Hal_Wr32(phost,(RAM_DL+DlBuffer_Index),cmd);
#endif
/* Increment the command index */
DlBuffer_Index += CMD_SIZE;
}
void App_WrCoStr_Buffer(Gpu_Hal_Context_t *phost,const char8_t *s)
{
#ifdef BUFFER_OPTIMIZATION
uint16_t length = 0;
if (CmdBuffer_Index >= CMD_FIFO_SIZE)
{
printf("CmdBuffer overflow\n");
if (CmdBuffer_Index > 0) {
Gpu_Hal_WrCmdBuf(phost, CmdBuffer, CmdBuffer_Index);//This blocking state may be infinite due to Display list overflow
}
CmdBuffer_Index = 0;
}
length = strlen(s) + 1;//last for the null termination
strcpy((char*)&CmdBuffer[CmdBuffer_Index],s);
/* increment the length and align it by 4 bytes */
CmdBuffer_Index += ((length + 3) & ~3);
#endif
}
void App_Flush_DL_Buffer(Gpu_Hal_Context_t *phost)
{
#ifdef BUFFER_OPTIMIZATION
if (DlBuffer_Index> 0)
Gpu_Hal_WrMem(phost,RAM_DL,DlBuffer,DlBuffer_Index);
#endif
DlBuffer_Index = 0;
}
void App_Flush_Co_Buffer(Gpu_Hal_Context_t *phost)
{
#ifdef BUFFER_OPTIMIZATION
if (CmdBuffer_Index > 0)
Gpu_Hal_WrCmdBuf(phost,CmdBuffer,CmdBuffer_Index);
#endif
CmdBuffer_Index = 0;
}
void App_Flush_Co_Buffer_nowait(Gpu_Hal_Context_t *phost)
{
#ifdef BUFFER_OPTIMIZATION
if (CmdBuffer_Index > 0)
Gpu_Hal_WrCmdBuf_nowait(phost, CmdBuffer, CmdBuffer_Index);
#endif
CmdBuffer_Index = 0;
}
void App_Set_DlBuffer_Index(uint32_t index)
{
DlBuffer_Index = index;
}
void App_Set_CmdBuffer_Index(uint32_t index)
{
CmdBuffer_Index = index;
}
/*************************************************************************************************
* Application Utilities
**************************************************************************************************/
static uint8_t sk=0;
uint8_t App_Read_Tag(Gpu_Hal_Context_t *phost)
{
static uint8_t Read_tag=0,temp_tag=0,ret_tag=0;
Read_tag = Gpu_Hal_Rd8(phost,REG_TOUCH_TAG);
ret_tag = 0;
if(Read_tag!=0) // Allow if the Key is released
{
if(temp_tag!=Read_tag)
{
temp_tag = Read_tag;
sk = Read_tag; // Load the Read tag to temp variable
}
}
else
{
if(temp_tag!=0)
{
ret_tag = temp_tag;
temp_tag = 0; //The event will be processed. Clear the tag
}
sk = 0;
}
return ret_tag;
}
uint8_t App_Touch_Update(Gpu_Hal_Context_t *phost, uint8_t *currTag, uint16_t *x, uint16_t *y)
{
static uint8_t Read_tag = 0, temp_tag = 0, ret_tag = 0;
uint32_t touch;
Read_tag = Gpu_Hal_Rd8(phost, REG_TOUCH_TAG);
ret_tag = 0;
if (Read_tag != 0) // Allow if the Key is released
{
if (temp_tag != Read_tag)
{
temp_tag = Read_tag;
sk = Read_tag; // Load the Read tag to temp variable
}
}
else
{
if (temp_tag != 0)
{
ret_tag = temp_tag;
temp_tag = 0; //The event will be processed. Clear the tag
}
sk = 0;
}
*currTag = Read_tag;
touch = Gpu_Hal_Rd32(phost, REG_TOUCH_SCREEN_XY);
*x = (uint16_t)(touch >> 16);
*y = (uint16_t)(touch & 0xFFFF);
return ret_tag;
}
void App_Play_Sound(Gpu_Hal_Context_t *phost, uint8_t sound,uint8_t vol,uint8_t midi)
{
uint16_t val = (midi << 8) | sound;
Gpu_Hal_Wr8(phost,REG_VOL_SOUND,vol);
Gpu_Hal_Wr16(phost,REG_SOUND,val);
Gpu_Hal_Wr8(phost,REG_PLAY,1);
}
void App_Calibrate_Screen(Gpu_Hal_Context_t *phost)
{
Gpu_CoCmd_Dlstart(phost);
App_WrCoCmd_Buffer(phost,CLEAR(1,1,1));
App_WrCoCmd_Buffer(phost,COLOR_RGB(255,255,255));
Gpu_CoCmd_Text(phost,DispWidth/2,DispHeight/2,26,OPT_CENTERX|OPT_CENTERY,"Please tap on a dot");
/* Calibration */
Gpu_CoCmd_Calibrate(phost,0);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);
}
/*************************************************************************************************
THIS PART DRAW BRIDGETEK LOGO
*************************************************************************************************/
//#define LOGO_SCALE_ANIMATION
/* Use bridgetek animation as default */
PROGMEM prog_uchar8_t logo_graphics[6224] = {
120, 218, 237, 93, 127, 112, 36, 71, 117, 158, 221, 213, 207, 149, 116,
44, 190, 56, 56, 72, 156, 20, 2, 4, 167, 184, 72, 49, 113, 165, 42, 196,
58, 249, 42, 135, 77, 37, 172, 20, 199, 103, 42, 14, 142, 54, 63, 140,
147, 2, 35, 37, 113, 217, 247, 7, 70, 138, 139, 248, 206, 84, 138, 85,
202, 137, 203, 103, 130, 87, 132, 10, 96, 217, 176, 71, 8, 33, 6, 131,
46, 84, 81, 16, 27, 103, 239, 236, 194, 21, 59, 94, 246, 226, 51, 196,
196, 216, 123, 62, 73, 43, 233, 36, 109, 103, 102, 119, 167, 231, 189,
158, 215, 61, 61, 163, 93, 157, 118, 153, 249, 235, 116, 253, 230, 125,
243, 125, 211, 63, 94, 191, 238, 233, 53, 140, 250, 92, 209, 175, 104,
24, 237, 95, 209, 112, 84, 208, 48, 218, 207, 86, 52, 28, 105, 24, 237,
103, 222, 70, 166, 35, 111, 35, 211, 145, 167, 145, 229, 200, 211, 200,
114, 228, 101, 84, 113, 228, 101, 84, 113, 228, 97, 84, 117, 228, 97, 84,
117, 164, 54, 170, 57, 82, 27, 213, 28, 41, 141, 108, 71, 74, 35, 219,
145, 202, 136, 59, 82, 25, 113, 71, 10, 35, 199, 145, 194, 200, 113, 36,
55, 2, 142, 228, 70, 192, 145, 212, 8, 58, 146, 26, 65, 71, 50, 35, 228,
72, 102, 132, 28, 73, 140, 176, 35, 137, 17, 118, 68, 27, 9, 142, 104,
35, 193, 17, 105, 36, 58, 34, 141, 68, 71, 148, 145, 203, 17, 101, 228,
114, 68, 24, 185, 29, 17, 70, 110, 71, 110, 35, 194, 145, 219, 136, 112,
228, 50, 162, 28, 185, 140, 40, 71, 162, 17, 233, 72, 52, 34, 29, 9, 70,
180, 35, 193, 136, 118, 132, 141, 36, 142, 176, 145, 196, 17, 50, 146,
57, 66, 70, 50, 71, 208, 72, 234, 8, 26, 73, 29, 1, 35, 185, 35, 96, 36,
119, 228, 24, 41, 28, 57, 70, 10, 71, 220, 72, 229, 136, 27, 169, 28,
217, 70, 74, 71, 182, 145, 210, 81, 205, 72, 237, 168, 102, 164, 118,
84, 53, 242, 112, 84, 53, 242, 112, 84, 49, 242, 114, 84, 49, 242, 114,
100, 25, 121, 58, 178, 140, 60, 29, 153, 70, 222, 142, 76, 35, 111, 71,
166, 81, 65, 195, 168, 141, 105, 24, 69, 138, 58, 112, 73, 29, 163, 182,
162, 134, 145, 134, 43, 211, 200, 219, 149, 245, 238, 146, 58, 70, 158,
174, 42, 245, 41, 169, 99, 228, 229, 170, 90, 199, 147, 58, 70, 30, 174,
106, 237, 46, 169, 99, 164, 118, 101, 247, 5, 73, 29, 35, 165, 43, 222,
63, 37, 117, 140, 84, 174, 156, 62, 51, 169, 99, 164, 112, 5, 250, 241,
164, 142, 145, 220, 21, 28, 91, 146, 58, 70, 82, 87, 104, 188, 75, 234,
24, 201, 92, 225, 49, 56, 169, 99, 36, 113, 37, 196, 5, 73, 29, 35, 218,
149, 24, 171, 36, 117, 140, 72, 87, 174, 248, 41, 169, 99, 68, 185, 114,
199, 116, 73, 29, 35, 194, 21, 17, 103, 38, 117, 140, 220, 174, 168,
216, 55, 169, 99, 228, 114, 69, 198, 227, 163, 58, 70, 177, 162, 134,
145, 232, 138, 54, 18, 92, 73, 230, 45, 163, 58, 70, 216, 149, 108, 46,
53, 170, 99, 132, 92, 73, 231, 119, 163, 58, 70, 208, 149, 124, 206, 57,
170, 99, 4, 92, 41, 230, 193, 163, 58, 70, 142, 43, 213, 220, 124, 84,
199, 136, 187, 82, 230, 11, 70, 117, 140, 108, 87, 234, 28, 198, 168,
142, 81, 205, 149, 71, 94, 101, 84, 199, 168, 234, 202, 43, 215, 51,
170, 99, 84, 113, 229, 153, 127, 26, 213, 49, 178, 92, 121, 231, 196,
70, 117, 140, 76, 87, 26, 121, 186, 81, 29, 163, 88, 81, 195, 200, 24,
213, 49, 138, 125, 95, 39, 87, 25, 49, 118, 242, 122, 125, 128, 123,
218, 254, 70, 39, 11, 42, 94, 151, 107, 189, 94, 241, 250, 57, 157, 74,
232, 186, 58, 138, 129, 110, 203, 176, 32, 183, 245, 179, 32, 183, 69,
114, 129, 110, 27, 96, 65, 110, 179, 193, 124, 222, 54, 192, 130, 220,
198, 193, 252, 221, 54, 192, 130, 220, 230, 128, 249, 186, 109, 128,
5, 185, 13, 128, 249, 185, 109, 128, 5, 185, 13, 130, 177, 23, 3, 129,
253, 40, 16, 88, 121, 36, 16, 216, 217, 16, 44, 4, 11, 193, 66, 176, 16,
172, 105, 192, 10, 129, 192, 222, 20, 130, 133, 96, 33, 88, 8, 22, 130,
133, 96, 33, 88, 8, 246, 211, 4, 246, 66, 48, 176, 161, 221, 9, 54, 16,
8, 204, 200, 6, 2, 235, 10, 6, 54, 30, 8, 204, 200, 5, 2, 107, 15, 6,
214, 23, 8, 12, 80, 243, 3, 102, 164, 3, 129, 57, 138, 248, 2, 139, 4,
3, 139, 5, 2, 115, 244, 95, 242, 151, 240, 181, 111, 155, 247, 117, 27,
175, 145, 211, 190, 110, 235, 180, 111, 155, 51, 2, 113, 243, 37, 164,
193, 55, 167, 108, 38, 252, 220, 22, 229, 239, 237, 223, 125, 193, 21,
130, 193, 101, 130, 193, 57, 45, 192, 23, 220, 62, 22, 8, 174, 147, 5,
131, 43, 4, 131, 155, 10, 6, 23, 103, 129, 224, 96, 234, 192, 15, 220,
47, 7, 131, 131, 203, 192, 126, 224, 70, 67, 184, 16, 46, 132, 11, 225,
66, 184, 16, 238, 98, 195, 157, 14, 6, 183, 21, 194, 133, 112, 33, 92,
8, 23, 194, 237, 90, 184, 161, 96, 112, 79, 133, 112, 33, 92, 8, 183,
227, 112, 79, 7, 131, 99, 95, 14, 6, 183, 18, 12, 206, 207, 30, 195,
209, 96, 183, 233, 237, 137, 87, 193, 249, 186, 77, 111, 223, 188, 2,
206, 223, 109, 122, 123, 235, 229, 112, 62, 111, 211, 219, 127, 239,
190, 174, 10, 118, 91, 100, 49, 208, 109, 70, 119, 176, 219, 140, 223,
14, 118, 91, 229, 190, 0, 183, 25, 191, 184, 24, 232, 54, 195, 248, 133,
131, 164, 92, 232, 175, 71, 18, 40, 7, 10, 103, 130, 89, 56, 193, 139,
163, 105, 98, 22, 206, 254, 226, 104, 14, 153, 133, 83, 195, 56, 154,
96, 102, 225, 188, 49, 142, 102, 159, 89, 56, 169, 236, 70, 83, 83, 97,
198, 153, 68, 133, 109, 69, 217, 199, 155, 41, 248, 169, 82, 201, 130,
79, 130, 34, 167, 176, 84, 125, 236, 36, 40, 178, 11, 75, 54, 221, 36,
40, 170, 22, 150, 28, 153, 146, 160, 200, 42, 44, 65, 121, 147, 41, 185,
244, 170, 235, 29, 99, 224, 143, 104, 1, 238, 68, 222, 207, 202, 99, 160,
8, 110, 83, 182, 62, 205, 229, 133, 213, 143, 121, 95, 4, 69, 188, 208,
254, 206, 247, 69, 80, 84, 43, 116, 62, 1, 126, 209, 128, 31, 13, 155,
133, 240, 235, 224, 179, 232, 51, 224, 23, 162, 104, 33, 52, 142, 150,
28, 65, 134, 220, 90, 149, 26, 64, 43, 91, 188, 176, 186, 96, 53, 128,
134, 193, 90, 161, 61, 184, 13, 160, 17, 178, 82, 232, 140, 123, 3, 104,
240, 52, 11, 225, 144, 56, 128, 198, 213, 200, 147, 104, 180, 188, 68,
245, 30, 226, 232, 253, 25, 89, 244, 114, 227, 232, 205, 91, 117, 184,
132, 10, 97, 113, 22, 85, 168, 56, 170, 109, 118, 237, 47, 161, 66, 187,
56, 139, 42, 113, 28, 213, 112, 184, 38, 92, 194, 127, 90, 197, 240, 69,
136, 197, 67, 168, 184, 132, 144, 170, 200, 113, 84, 232, 44, 54, 165,
96, 247, 233, 112, 202, 32, 74, 213, 98, 160, 71, 6, 201, 97, 21, 35,
45, 51, 72, 74, 163, 187, 132, 223, 195, 152, 178, 181, 224, 73, 78,
39, 222, 183, 63, 83, 134, 55, 119, 226, 109, 253, 51, 12, 182, 166,
78, 188, 235, 127, 134, 193, 246, 212, 137, 63, 10, 152, 97, 176, 69,
117, 226, 111, 6, 102, 24, 108, 83, 157, 248, 147, 130, 25, 180, 218,
13, 10, 217, 58, 42, 180, 22, 58, 115, 168, 16, 238, 28, 152, 131, 173,
167, 82, 8, 138, 231, 96, 251, 169, 21, 242, 226, 57, 216, 130, 120, 97,
173, 120, 14, 182, 33, 80, 88, 41, 134, 43, 175, 145, 220, 58, 146, 121,
96, 206, 208, 239, 234, 186, 240, 27, 203, 156, 198, 227, 50, 154, 181,
102, 208, 108, 180, 27, 79, 106, 51, 104, 178, 218, 141, 131, 225, 44,
138, 169, 227, 56, 86, 206, 162, 144, 59, 142, 67, 233, 44, 138, 200,
163, 66, 164, 45, 4, 236, 40, 16, 199, 33, 104, 9, 135, 150, 41, 20,
195, 149, 112, 108, 150, 66, 49, 87, 9, 199, 82, 41, 20, 146, 149, 112,
168, 149, 66, 17, 91, 9, 71, 98, 168, 89, 141, 226, 102, 21, 75, 41, 227,
42, 188, 87, 103, 0, 53, 171, 72, 14, 53, 171, 1, 212, 172, 172, 170, 3,
138, 7, 80, 179, 170, 86, 59, 94, 60, 128, 154, 149, 93, 101, 107, 197,
3, 168, 89, 57, 213, 189, 82, 60, 128, 154, 21, 218, 195, 45, 238, 205,
22, 54, 120, 195, 63, 207, 34, 79, 149, 253, 73, 78, 241, 89, 244, 20,
181, 205, 75, 118, 241, 89, 196, 128, 239, 108, 170, 22, 159, 69, 236,
193, 182, 39, 171, 248, 44, 82, 14, 237, 137, 138, 228, 240, 198, 170,
55, 170, 54, 76, 69, 113, 43, 154, 69, 141, 104, 13, 183, 161, 89, 212,
132, 214, 112, 11, 154, 69, 13, 104, 13, 245, 232, 181, 66, 59, 40, 91,
67, 99, 65, 165, 208, 137, 215, 214, 96, 145, 85, 8, 118, 246, 88, 133,
105, 6, 11, 225, 214, 164, 85, 84, 184, 138, 246, 45, 89, 251, 68, 210,
168, 213, 116, 225, 33, 50, 141, 218, 76, 23, 30, 92, 211, 168, 197, 116,
225, 97, 57, 141, 218, 75, 23, 30, 208, 211, 168, 181, 116, 41, 26, 75,
59, 26, 159, 38, 97, 75, 105, 135, 45, 193, 152, 132, 237, 164, 29, 182,
3, 171, 200, 41, 236, 128, 173, 192, 222, 210, 176, 12, 138, 204, 107,
12, 20, 85, 11, 59, 28, 205, 198, 208, 70, 136, 101, 88, 196, 46, 192,
34, 54, 223, 142, 138, 106, 179, 41, 123, 95, 79, 63, 40, 50, 64, 225,
188, 5, 222, 15, 138, 156, 194, 249, 234, 67, 247, 131, 34, 187, 112,
222, 38, 219, 15, 138, 170, 133, 243, 142, 72, 253, 160, 200, 42, 156,
135, 226, 254, 172, 17, 94, 187, 241, 234, 165, 14, 218, 40, 191, 242,
252, 227, 119, 31, 244, 233, 105, 15, 112, 112, 74, 102, 212, 134, 59,
150, 6, 243, 168, 94, 27, 127, 209, 26, 60, 24, 251, 78, 162, 53, 120,
176, 31, 182, 8, 15, 246, 233, 22, 225, 225, 35, 19, 189, 171, 121, 176,
147, 45, 194, 99, 173, 69, 120, 176, 137, 22, 225, 113, 170, 69, 120,
44, 181, 8, 143, 245, 22, 225, 81, 110, 17, 30, 218, 13, 125, 183, 243,
152, 107, 17, 30, 39, 90, 132, 199, 169, 22, 225, 113, 174, 69, 120,
232, 14, 32, 125, 175, 58, 215, 201, 139, 204, 35, 159, 207, 23, 116,
78, 73, 12, 124, 237, 12, 143, 202, 88, 241, 150, 27, 49, 143, 213, 38,
229, 33, 158, 235, 216, 188, 60, 218, 2, 70, 238, 187, 141, 7, 62, 254,
121, 189, 121, 121, 164, 91, 132, 199, 1, 134, 114, 188, 77, 203, 99,
184, 69, 120, 12, 162, 180, 98, 243, 242, 120, 93, 43, 242, 104, 226,
122, 181, 167, 21, 121, 172, 183, 8, 143, 181, 86, 231, 113, 233, 61,
15, 255, 224, 249, 71, 143, 122, 30, 241, 177, 247, 125, 31, 127, 242,
249, 135, 110, 79, 168, 121, 188, 237, 147, 79, 190, 242, 196, 67, 127,
105, 104, 120, 123, 236, 123, 249, 87, 159, 127, 226, 161, 251, 255,
216, 23, 15, 30, 39, 222, 184, 192, 175, 207, 24, 70, 196, 14, 139,
203, 127, 94, 45, 238, 118, 138, 23, 224, 156, 222, 182, 219, 248, 67,
21, 143, 143, 212, 254, 243, 255, 126, 199, 250, 235, 1, 199, 213, 16,
102, 251, 69, 248, 104, 155, 159, 187, 58, 0, 143, 52, 154, 147, 92,
229, 228, 228, 71, 84, 243, 193, 247, 58, 255, 251, 183, 114, 30, 55,
57, 207, 48, 141, 3, 60, 200, 35, 250, 41, 87, 86, 234, 239, 180, 121,
148, 72, 30, 112, 135, 231, 89, 5, 143, 55, 194, 69, 136, 49, 25, 15,
184, 35, 110, 115, 68, 198, 35, 154, 33, 166, 171, 255, 53, 164, 201,
99, 133, 228, 49, 9, 111, 75, 200, 121, 44, 226, 166, 38, 225, 177, 40,
116, 144, 36, 143, 72, 134, 156, 119, 255, 175, 230, 56, 184, 76, 241,
136, 34, 87, 179, 82, 30, 61, 24, 115, 158, 230, 33, 90, 209, 60, 100,
191, 56, 243, 45, 189, 248, 234, 60, 197, 35, 142, 60, 157, 145, 242,
152, 18, 146, 197, 52, 143, 25, 49, 165, 76, 241, 144, 254, 186, 78,
57, 165, 21, 239, 158, 161, 120, 28, 112, 167, 84, 40, 30, 174, 159,
209, 249, 19, 138, 71, 84, 180, 154, 165, 120, 168, 127, 145, 202, 123,
254, 113, 146, 226, 177, 232, 158, 194, 83, 60, 186, 68, 200, 11, 20,
143, 30, 209, 106, 149, 224, 17, 41, 200, 83, 233, 35, 18, 30, 83, 100,
126, 23, 240, 216, 16, 158, 78, 198, 163, 79, 107, 201, 110, 88, 101,
53, 36, 147, 4, 31, 248, 68, 242, 128, 167, 92, 87, 247, 17, 185, 102,
187, 204, 21, 218, 83, 60, 134, 181, 120, 164, 117, 120, 236, 83, 216,
92, 160, 121, 196, 232, 245, 15, 57, 220, 150, 140, 199, 148, 22, 143,
130, 14, 143, 140, 218, 136, 226, 209, 79, 135, 87, 105, 245, 90, 15,
197, 35, 171, 195, 35, 198, 52, 120, 68, 61, 214, 54, 8, 30, 111, 43,
208, 233, 221, 0, 60, 22, 117, 120, 116, 232, 240, 232, 84, 26, 189, 38,
228, 119, 143, 31, 63, 254, 176, 240, 150, 103, 183, 195, 35, 167, 195,
35, 174, 195, 163, 71, 105, 180, 226, 153, 111, 7, 155, 166, 3, 240, 40,
234, 240, 232, 211, 225, 177, 199, 99, 49, 214, 139, 199, 178, 177, 29,
30, 90, 91, 37, 6, 117, 120, 140, 195, 255, 123, 233, 250, 43, 14, 221,
137, 2, 120, 47, 30, 112, 83, 104, 163, 120, 12, 235, 240, 72, 187, 102,
218, 232, 113, 188, 120, 192, 15, 107, 26, 197, 3, 69, 15, 207, 28, 188,
228, 154, 34, 193, 3, 246, 24, 167, 221, 17, 238, 144, 154, 199, 122, 66,
194, 163, 124, 239, 155, 175, 201, 249, 228, 241, 210, 193, 189, 191,
239, 197, 99, 221, 213, 166, 135, 220, 99, 204, 188, 123, 128, 31, 81,
242, 120, 9, 77, 42, 211, 66, 179, 137, 251, 227, 81, 233, 49, 166, 8,
30, 227, 162, 212, 81, 130, 71, 209, 213, 133, 162, 238, 122, 76, 193,
163, 252, 57, 188, 61, 49, 45, 72, 210, 230, 143, 199, 146, 40, 181, 205,
99, 210, 37, 117, 193, 205, 3, 122, 170, 30, 88, 216, 142, 54, 43, 200,
121, 124, 71, 76, 132, 164, 5, 87, 17, 127, 60, 206, 136, 195, 25, 197,
99, 214, 213, 24, 170, 60, 34, 30, 60, 82, 114, 30, 47, 223, 119, 181,
156, 199, 132, 127, 30, 39, 69, 112, 138, 199, 180, 43, 156, 25, 114,
135, 37, 254, 120, 152, 215, 183, 235, 206, 163, 45, 32, 143, 216, 182,
120, 224, 134, 126, 49, 121, 180, 109, 143, 7, 250, 24, 239, 98, 242,
104, 223, 38, 15, 16, 38, 54, 55, 143, 141, 22, 225, 33, 137, 219, 155,
143, 199, 114, 139, 240, 40, 39, 90, 131, 135, 83, 177, 154, 135, 71,
249, 176, 121, 253, 233, 35, 152, 199, 255, 236, 58, 30, 196, 149, 162,
242, 37, 239, 101, 94, 235, 6, 213, 77, 164, 119, 216, 215, 237, 187,
147, 7, 78, 115, 108, 74, 121, 120, 239, 235, 187, 200, 60, 198, 201, 76,
88, 243, 241, 192, 25, 140, 137, 166, 229, 209, 201, 168, 68, 117, 243,
241, 192, 119, 157, 106, 90, 30, 56, 227, 122, 174, 105, 121, 68, 133,
228, 105, 179, 242, 64, 179, 97, 190, 64, 216, 124, 60, 112, 222, 105,
169, 69, 120, 44, 183, 8, 143, 149, 22, 225, 81, 106, 17, 30, 107, 45,
194, 99, 125, 183, 241, 184, 235, 205, 174, 43, 161, 193, 227, 194, 110,
227, 49, 173, 187, 31, 46, 228, 177, 155, 121, 172, 135, 60, 46, 50, 143,
200, 238, 238, 119, 181, 121, 196, 90, 132, 7, 254, 176, 104, 181, 105,
121, 180, 55, 5, 143, 215, 131, 139, 230, 209, 181, 187, 227, 171, 105,
119, 118, 42, 229, 189, 239, 117, 87, 196, 237, 109, 129, 120, 76, 238,
186, 249, 96, 44, 8, 143, 104, 174, 17, 121, 134, 83, 117, 94, 175, 245,
230, 241, 81, 214, 136, 188, 207, 57, 177, 229, 5, 94, 63, 159, 117, 111,
238, 74, 185, 246, 145, 29, 127, 164, 32, 196, 246, 39, 130, 243, 40,
138, 221, 197, 155, 60, 120, 104, 237, 103, 152, 115, 59, 159, 240, 94,
255, 216, 78, 62, 177, 40, 228, 87, 225, 105, 115, 36, 15, 173, 253, 37,
39, 220, 175, 104, 76, 131, 199, 116, 112, 30, 232, 213, 110, 30, 189,
37, 75, 197, 9, 227, 98, 44, 231, 181, 223, 103, 201, 189, 29, 80, 135,
199, 72, 157, 120, 136, 151, 175, 253, 87, 80, 129, 45, 107, 115, 91,
100, 6, 61, 163, 55, 143, 242, 54, 214, 63, 114, 190, 121, 184, 174, 33,
98, 39, 240, 214, 67, 71, 239, 193, 91, 106, 135, 188, 121, 92, 216, 6,
143, 69, 29, 30, 131, 58, 60, 212, 155, 255, 88, 194, 155, 199, 202, 54,
120, 164, 117, 120, 212, 97, 191, 232, 166, 198, 57, 19, 175, 109, 131,
135, 214, 190, 112, 173, 253, 187, 106, 163, 117, 63, 231, 176, 4, 224,
49, 174, 195, 163, 83, 135, 71, 135, 71, 157, 233, 213, 238, 174, 130,
240, 24, 212, 225, 17, 213, 225, 17, 41, 170, 235, 140, 143, 115, 163,
2, 240, 232, 213, 225, 161, 238, 213, 134, 116, 170, 232, 73, 111, 30,
47, 108, 135, 135, 187, 202, 20, 9, 30, 51, 58, 60, 148, 189, 193, 152,
55, 143, 233, 237, 240, 112, 85, 153, 242, 56, 193, 99, 159, 14, 15, 85,
134, 119, 195, 251, 92, 156, 11, 198, 118, 120, 184, 170, 204, 202, 48,
193, 67, 124, 196, 173, 28, 193, 67, 53, 22, 45, 121, 243, 152, 219, 30,
15, 177, 195, 154, 167, 120, 136, 143, 248, 84, 150, 226, 209, 163, 172,
51, 30, 60, 214, 140, 237, 241, 232, 22, 170, 85, 130, 228, 49, 128, 141,
134, 72, 30, 242, 143, 123, 74, 94, 61, 10, 219, 154, 216, 38, 15, 225,
107, 185, 21, 131, 228, 17, 65, 213, 239, 172, 65, 243, 232, 150, 46,
126, 120, 241, 216, 74, 25, 219, 228, 97, 188, 3, 41, 61, 65, 243, 64,
95, 19, 175, 39, 36, 60, 170, 191, 4, 228, 190, 190, 236, 213, 195, 191,
60, 97, 108, 155, 7, 154, 57, 61, 109, 72, 120, 128, 71, 180, 130, 114,
9, 15, 227, 253, 82, 26, 114, 30, 229, 103, 255, 200, 48, 182, 207, 195,
104, 115, 136, 108, 36, 164, 60, 140, 27, 107, 3, 203, 143, 199, 12, 57,
15, 227, 90, 215, 144, 249, 114, 237, 4, 129, 182, 195, 212, 117, 253,
59, 127, 222, 253, 160, 111, 5, 6, 196, 65, 201, 208, 19, 248, 138, 199,
136, 253, 67, 13, 242, 171, 214, 35, 93, 234, 24, 93, 135, 110, 143, 221,
243, 216, 15, 126, 242, 232, 199, 36, 249, 18, 254, 122, 127, 239, 27,
176, 222, 63, 126, 155, 177, 131, 87, 236, 134, 35, 199, 143, 222, 124,
181, 254, 13, 114, 30, 214, 216, 122, 232, 150, 35, 247, 28, 191, 255,
232, 237, 55, 31, 52, 118, 249, 165, 228, 209, 68, 87, 200, 35, 228, 17,
242, 104, 57, 30, 61, 226, 83, 195, 24, 32, 209, 60, 60, 122, 69, 30,
48, 184, 52, 154, 146, 199, 152, 152, 92, 47, 55, 39, 143, 57, 113, 86,
191, 213, 156, 60, 214, 204, 230, 16, 153, 66, 153, 194, 166, 108, 231,
108, 227, 243, 247, 124, 83, 72, 33, 52, 205, 213, 173, 57, 177, 222,
237, 151, 234, 136, 149, 165, 38, 226, 161, 202, 221, 158, 105, 34, 30,
170, 4, 239, 124, 51, 197, 33, 138, 229, 183, 137, 102, 226, 145, 145,
103, 108, 154, 42, 46, 148, 175, 16, 46, 55, 21, 143, 120, 107, 52, 15,
121, 67, 47, 55, 217, 236, 99, 82, 194, 227, 197, 38, 155, 56, 73, 70,
144, 173, 38, 123, 29, 134, 241, 97, 146, 199, 151, 154, 110, 38, 27,
165, 86, 105, 158, 105, 194, 41, 121, 135, 123, 44, 252, 118, 83, 230,
22, 98, 15, 210, 9, 232, 230, 187, 174, 249, 130, 211, 192, 191, 118,
155, 209, 196, 215, 222, 67, 55, 28, 57, 122, 251, 7, 14, 255, 138, 17,
94, 254, 175, 134, 103, 153, 66, 128, 16, 32, 4, 8, 1, 234, 3, 16, 165,
119, 211, 132, 0, 33, 64, 8, 16, 2, 132, 0, 33, 64, 8, 176, 219, 0, 46,
121, 247, 199, 191, 254, 189, 252, 171, 249, 39, 22, 238, 191, 45, 225,
23, 160, 123, 97, 225, 97, 152, 141, 170, 254, 192, 202, 63, 1, 139, 75,
209, 15, 147, 108, 253, 219, 117, 30, 0, 240, 55, 95, 38, 100, 31, 33,
56, 63, 52, 24, 249, 136, 171, 240, 43, 9, 37, 192, 56, 218, 220, 236,
5, 16, 249, 40, 81, 90, 217, 9, 39, 5, 200, 224, 165, 104, 15, 128, 91,
233, 189, 200, 9, 5, 64, 17, 111, 133, 87, 3, 200, 18, 210, 63, 148, 3,
180, 11, 217, 119, 53, 64, 214, 59, 225, 45, 2, 196, 133, 253, 136, 74,
128, 184, 198, 134, 109, 17, 96, 80, 216, 14, 173, 4, 200, 104, 236,
108, 23, 1, 166, 132, 175, 42, 84, 0, 49, 157, 47, 125, 68, 128, 69,
97, 33, 71, 5, 160, 58, 160, 158, 159, 253, 40, 0, 68, 197, 5, 97, 21,
192, 184, 206, 238, 127, 1, 160, 83, 92, 169, 85, 1, 40, 63, 183, 56,
69, 3, 244, 137, 38, 10, 0, 245, 119, 41, 37, 26, 0, 46, 73, 205, 122,
0, 116, 104, 125, 89, 32, 0, 164, 197, 79, 115, 20, 0, 234, 143, 152,
182, 104, 128, 130, 104, 161, 0, 192, 63, 96, 119, 253, 21, 87, 126,
144, 250, 198, 2, 3, 184, 63, 177, 86, 0, 64, 57, 171, 63, 137, 112,
128, 88, 117, 197, 0, 221, 174, 229, 126, 5, 192, 148, 203, 184, 147,
168, 167, 24, 192, 189, 51, 186, 253, 240, 225, 247, 193, 205, 43, 96,
35, 113, 218, 181, 104, 143, 154, 246, 44, 5, 48, 73, 245, 38, 178, 49,
57, 227, 122, 154, 8, 241, 97, 7, 6, 32, 55, 212, 201, 0, 178, 232, 3,
165, 202, 69, 244, 216, 8, 32, 66, 238, 228, 145, 1, 44, 170, 1, 78,
16, 0, 29, 228, 184, 46, 3, 200, 249, 7, 128, 251, 232, 207, 123, 2,
20, 252, 3, 12, 187, 111, 81, 0, 20, 253, 3, 204, 144, 31, 91, 201,
0, 152, 127, 128, 2, 185, 43, 179, 126, 0, 123, 233, 237, 96, 245, 3,
184, 140, 172, 68, 117, 4, 216, 71, 86, 162, 58, 2, 76, 82, 223, 155,
214, 19, 32, 39, 124, 238, 83, 119, 0, 70, 207, 21, 116, 0, 136, 75,
13, 176, 97, 52, 24, 160, 212, 104, 128, 215, 26, 13, 112, 162, 209, 0,
179, 141, 6, 56, 213, 104, 128, 165, 70, 3, 172, 53, 26, 96, 171, 33,
0, 69, 38, 110, 175, 174, 51, 192, 12, 253, 185, 106, 253, 0, 134, 233,
253, 149, 245, 3, 232, 167, 119, 168, 213, 15, 224, 13, 180, 167, 250,
1, 92, 66, 205, 18, 245, 0, 190, 69, 156, 58, 73, 68, 21, 57, 114, 83,
165, 143, 1, 199, 43, 227, 53, 67, 102, 27, 234, 8, 112, 128, 236, 176,
235, 8, 208, 71, 14, 57, 117, 4, 232, 34, 7, 205, 58, 2, 180, 145, 195,
126, 29, 1, 80, 192, 156, 106, 4, 64, 134, 186, 167, 158, 0, 147, 84,
240, 232, 3, 32, 2, 142, 181, 163, 26, 26, 58, 30, 97, 53, 0, 192, 148,
199, 252, 0, 255, 122, 115, 128, 25, 142, 39, 0, 58, 24, 97, 196, 255,
28, 205, 19, 128, 58, 70, 12, 1, 108, 168, 103, 153, 158, 0, 232, 79,
234, 116, 139, 77, 73, 253, 168, 217, 206, 120, 2, 76, 17, 161, 75, 84,
18, 117, 103, 221, 3, 96, 198, 99, 166, 143, 79, 46, 90, 167, 0, 102,
233, 92, 197, 107, 110, 213, 200, 92, 5, 250, 164, 157, 60, 217, 30, 4,
76, 105, 215, 127, 183, 123, 102, 91, 112, 198, 103, 140, 0, 96, 207,
221, 125, 228, 129, 175, 87, 254, 31, 237, 12, 182, 126, 73, 222, 248,
3, 111, 128, 24, 145, 144, 137, 72, 194, 178, 65, 148, 136, 125, 232,
232, 145, 79, 49, 207, 132, 20, 174, 220, 103, 100, 163, 123, 21, 64,
125, 140, 19, 157, 82, 195, 194, 174, 16, 77, 22, 0, 116, 171, 1, 134,
104, 128, 3, 68, 179, 45, 208, 0, 237, 65, 210, 154, 56, 9, 152, 144,
4, 200, 91, 146, 119, 163, 145, 152, 197, 188, 83, 238, 246, 9, 159,
46, 27, 32, 181, 140, 15, 203, 172, 181, 246, 3, 18, 0, 229, 121, 98,
231, 53, 22, 137, 236, 246, 185, 71, 2, 160, 250, 200, 138, 135, 231,
46, 128, 172, 155, 102, 151, 4, 64, 117, 226, 147, 108, 129, 2, 183,
207, 77, 137, 35, 187, 134, 40, 142, 98, 90, 147, 174, 163, 13, 18, 117,
57, 45, 1, 80, 36, 248, 191, 36, 5, 232, 33, 154, 123, 143, 108, 6, 39,
165, 176, 33, 95, 9, 236, 160, 130, 133, 156, 4, 160, 221, 255, 66, 29,
238, 59, 237, 186, 214, 47, 155, 131, 94, 78, 251, 255, 190, 106, 61,
57, 71, 189, 170, 15, 203, 38, 185, 191, 68, 249, 127, 70, 185, 96, 61,
67, 121, 138, 220, 41, 155, 69, 255, 154, 171, 35, 217, 252, 152, 122,
69, 124, 152, 10, 93, 12, 227, 61, 255, 73, 3, 24, 198, 181, 143, 129,
106, 92, 126, 226, 239, 241, 194, 250, 149, 224, 144, 147, 234, 255,
160, 3, 84, 134, 128, 233, 91, 111, 57, 114, 252, 216, 237, 55, 255,
230, 21, 174, 163, 84, 34, 87, 86, 78, 254, 56, 118, 199, 7, 14, 54,
209, 215, 233, 63, 53, 215, 222, 235, 135, 52, 172, 126, 230, 250, 29,
124, 119, 111, 249, 93, 77, 176, 200, 149, 7, 181, 74, 162, 135, 92,
123, 254, 173, 30, 232, 39, 247, 218, 127, 153, 61, 97, 249, 113, 158,
94, 234, 227, 221, 203, 140, 117, 194, 145, 211, 142, 46, 47, 130, 51,
180, 114, 224, 48, 196, 105, 51, 218, 227, 191, 164, 247, 46, 179, 159,
28, 169, 167, 30, 157, 104, 248, 155, 66, 173, 248, 253, 213, 175, 220,
107, 113, 112, 202, 156, 29, 217, 41, 160, 113, 43, 110, 158, 228, 107,
40, 209, 44, 248, 150, 166, 23, 46, 28, 68, 30, 132, 253, 150, 117, 18,
211, 63, 243, 200, 125, 194, 226, 89, 235, 219, 103, 249, 205, 214, 72,
96, 251, 221, 131, 79, 202, 230, 153, 131, 104, 1, 246, 162, 5, 187,
55, 234, 180, 6, 135, 46, 158, 193, 104, 19, 146, 86, 219, 191, 186,
208, 64, 50, 3, 195, 251, 10, 141, 211, 156, 219, 180, 249, 218, 237,
160, 115, 210, 50, 154, 226, 93, 230, 40, 92, 222, 234, 131, 201, 217,
253, 40, 79, 56, 9, 250, 217, 41, 19, 51, 106, 70, 7, 29, 40, 154, 237,
69, 9, 112, 65, 44, 158, 138, 234, 65, 249, 77, 40, 214, 107, 64, 172,
125, 66, 126, 172, 161, 98, 13, 195, 153, 151, 40, 150, 249, 128, 142,
88, 5, 56, 9, 68, 98, 45, 66, 37, 170, 227, 119, 77, 254, 65, 115, 62,
209, 201, 86, 77, 177, 202, 11, 57, 94, 155, 123, 217, 230, 195, 69,
126, 3, 20, 235, 185, 111, 58, 41, 142, 113, 182, 241, 103, 69, 46, 41,
20, 107, 5, 136, 53, 195, 46, 124, 144, 254, 81, 129, 160, 87, 219, 194,
2, 99, 95, 91, 224, 49, 248, 115, 11, 11, 159, 231, 15, 184, 246, 33,
30, 254, 187, 196, 154, 118, 196, 50, 43, 199, 103, 63, 193, 99, 125,
40, 150, 57, 155, 251, 215, 79, 112, 37, 204, 23, 115, 223, 162, 221,
152, 122, 76, 179, 30, 83, 140, 14, 51, 254, 234, 224, 225, 97, 175,
217, 110, 250, 121, 68, 6, 197, 154, 53, 123, 130, 37, 46, 195, 73, 83,
176, 51, 132, 88, 235, 64, 172, 69, 243, 158, 25, 180, 76, 83, 135, 11,
172, 223, 206, 192, 212, 122, 206, 20, 132, 63, 136, 75, 172, 19, 142,
88, 221, 166, 80, 29, 224, 103, 25, 29, 177, 58, 204, 118, 22, 227, 130,
247, 154, 21, 169, 203, 174, 171, 29, 102, 167, 51, 104, 146, 182, 196,
50, 97, 198, 28, 177, 98, 92, 93, 44, 214, 30, 222, 105, 101, 205, 199,
116, 58, 127, 40, 214, 22, 16, 171, 192, 172, 3, 3, 207, 236, 140, 88,
69, 147, 65, 218, 158, 247, 185, 196, 58, 231, 136, 213, 99, 138, 16,
229, 146, 64, 177, 186, 45, 105, 120, 239, 178, 199, 44, 137, 241, 73,
140, 249, 143, 113, 211, 105, 69, 172, 69, 27, 198, 18, 203, 224, 103,
240, 96, 177, 122, 121, 159, 110, 213, 153, 246, 187, 71, 8, 177, 216,
144, 35, 150, 133, 219, 249, 215, 67, 59, 35, 150, 213, 47, 189, 235, 62,
89, 51, 92, 118, 196, 234, 51, 95, 121, 132, 123, 129, 98, 197, 45, 177,
138, 118, 199, 60, 104, 149, 28, 189, 142, 51, 78, 100, 204, 123, 106,
98, 77, 0, 177, 138, 206, 65, 213, 80, 172, 30, 48, 171, 159, 70, 73,
67, 46, 214, 22, 75, 97, 177, 234, 126, 169, 196, 2, 57, 58, 44, 86, 97,
205, 37, 214, 136, 91, 172, 30, 171, 50, 0, 177, 64, 80, 97, 222, 158,
42, 108, 26, 85, 177, 114, 246, 205, 181, 154, 149, 160, 196, 138, 123,
139, 181, 198, 230, 161, 88, 35, 59, 38, 86, 4, 157, 16, 38, 138, 149,
222, 132, 98, 173, 128, 71, 115, 137, 85, 176, 219, 24, 22, 107, 144,
253, 163, 149, 44, 183, 196, 138, 240, 14, 207, 18, 43, 202, 83, 181,
88, 172, 110, 46, 86, 14, 238, 160, 128, 98, 45, 179, 51, 187, 81, 172,
36, 75, 112, 177, 246, 40, 196, 90, 5, 98, 13, 35, 177, 122, 216, 143,
172, 191, 205, 49, 224, 87, 63, 196, 151, 24, 44, 177, 248, 24, 32, 136,
213, 197, 71, 73, 169, 88, 231, 11, 75, 92, 172, 72, 67, 142, 131, 67,
98, 125, 154, 47, 158, 136, 98, 221, 251, 206, 223, 0, 98, 253, 22, 155,
0, 98, 45, 87, 135, 3, 90, 172, 156, 35, 22, 220, 207, 97, 142, 159, 86,
224, 36, 70, 240, 107, 55, 100, 249, 168, 135, 197, 234, 4, 98, 77, 92,
118, 236, 216, 93, 132, 88, 233, 85, 36, 214, 219, 143, 29, 251, 171, 6,
138, 229, 36, 159, 35, 196, 186, 130, 35, 214, 187, 217, 156, 150, 88,
37, 44, 86, 236, 216, 177, 99, 78, 205, 181, 186, 158, 14, 52, 193, 233,
133, 113, 171, 32, 86, 7, 111, 158, 102, 80, 48, 236, 204, 126, 160, 88,
227, 27, 80, 44, 179, 242, 163, 202, 220, 0, 177, 206, 241, 120, 91, 33,
214, 65, 118, 10, 136, 181, 4, 66, 37, 40, 86, 175, 197, 104, 209, 17,
235, 92, 23, 88, 218, 89, 172, 0, 87, 107, 214, 89, 40, 214, 214, 72,
96, 177, 246, 176, 203, 118, 161, 88, 99, 133, 243, 219, 21, 107, 170,
66, 222, 148, 224, 208, 173, 96, 186, 3, 55, 254, 200, 155, 97, 74, 34,
86, 15, 187, 22, 54, 195, 201, 198, 138, 245, 236, 241, 227, 179, 116,
51, 252, 234, 29, 119, 66, 177, 50, 165, 32, 205, 176, 3, 136, 53, 88,
233, 214, 43, 163, 97, 209, 137, 224, 87, 223, 227, 44, 40, 171, 58,
248, 110, 254, 48, 80, 172, 14, 118, 12, 117, 240, 189, 13, 21, 75,
119, 52, 28, 155, 188, 32, 138, 53, 162, 213, 193, 23, 153, 147, 173,
90, 174, 137, 101, 78, 251, 102, 249, 104, 24, 115, 22, 121, 229, 161,
195, 180, 68, 172, 40, 251, 46, 10, 29, 250, 208, 152, 114, 209, 196,
26, 44, 7, 11, 29, 72, 177, 102, 236, 180, 135, 21, 58, 20, 216, 144,
225, 29, 148, 198, 73, 177, 140, 194, 250, 197, 18, 75, 17, 193, 143,
245, 176, 76, 160, 160, 148, 121, 138, 149, 225, 241, 185, 124, 186,
51, 43, 19, 43, 83, 70, 211, 157, 61, 59, 36, 150, 122, 186, 51, 214,
201, 138, 254, 167, 59, 75, 18, 177, 210, 160, 25, 154, 211, 235, 147,
26, 19, 233, 30, 158, 4, 69, 98, 77, 50, 65, 172, 115, 59, 39, 86, 242,
209, 33, 137, 88, 49, 198, 160, 88, 81, 205, 137, 116, 132, 20, 11, 101,
29, 28, 137, 176, 88, 251, 56, 124, 198, 124, 204, 94, 14, 131, 196, 26,
100, 40, 69, 243, 186, 157, 76, 209, 100, 100, 41, 154, 49, 43, 61, 170,
155, 162, 1, 33, 70, 196, 73, 241, 59, 98, 117, 50, 152, 207, 138, 243,
225, 16, 137, 21, 93, 4, 203, 23, 167, 141, 3, 188, 206, 32, 177, 122,
28, 177, 178, 102, 219, 158, 218, 169, 228, 223, 34, 155, 139, 72, 147,
127, 150, 142, 78, 242, 111, 211, 74, 143, 144, 201, 191, 173, 68, 59,
72, 254, 173, 155, 118, 23, 68, 177, 88, 158, 129, 56, 107, 217, 104,
39, 39, 210, 175, 20, 156, 220, 252, 1, 182, 245, 0, 153, 86, 62, 95,
205, 195, 243, 56, 238, 147, 245, 77, 43, 139, 98, 189, 146, 207, 255,
55, 255, 99, 227, 65, 158, 14, 112, 139, 53, 201, 197, 106, 99, 236, 63,
22, 249, 236, 183, 143, 149, 243, 249, 124, 202, 14, 108, 159, 253, 34,
15, 143, 76, 34, 223, 93, 116, 214, 104, 184, 88, 96, 17, 198, 18, 43,
194, 168, 124, 22, 92, 83, 142, 163, 191, 144, 88, 49, 71, 172, 190,
186, 47, 88, 16, 17, 124, 25, 174, 142, 172, 74, 197, 26, 116, 30, 55,
7, 119, 16, 244, 193, 153, 113, 6, 42, 81, 221, 225, 113, 138, 16, 139,
255, 2, 77, 37, 159, 197, 123, 48, 65, 44, 126, 172, 99, 101, 27, 68,
137, 202, 58, 88, 127, 217, 98, 197, 138, 96, 30, 213, 104, 177, 218,
224, 170, 148, 91, 172, 94, 71, 172, 253, 112, 101, 10, 137, 213, 143,
118, 193, 90, 75, 102, 206, 129, 156, 85, 177, 218, 242, 249, 231, 31,
229, 22, 241, 252, 83, 134, 113, 83, 190, 214, 25, 244, 228, 237, 41,
245, 173, 166, 213, 103, 157, 74, 242, 134, 2, 219, 224, 105, 208, 47,
228, 107, 46, 219, 45, 243, 59, 243, 246, 88, 106, 188, 189, 200, 126,
92, 239, 44, 205, 55, 242, 252, 41, 110, 50, 27, 16, 111, 134, 198, 175,
131, 5, 210, 59, 243, 19, 70, 87, 254, 233, 218, 95, 87, 153, 207, 215,
158, 183, 31, 178, 242, 137, 254, 103, 28, 190, 121, 222, 12, 141, 200,
173, 140, 253, 11, 71, 138, 154, 205, 250, 46, 3, 9, 19, 240, 138, 92,
161, 101, 181, 147, 103, 222, 69, 181, 193, 246, 14, 233, 149, 236, 117,
117, 33, 255, 15, 136, 52, 18, 253};
static const struct element {
uint32_t src;
uint16_t w, h, x0, y0;
} el[] = {
{ 0, 74, 145, 54, 48 },
{ 5365, 110, 218, 18, 11 },
{ 17355, 28, 29, 8, 66 },
{ 17761, 28, 29, 8, 145 },
{ 18167, 30, 28, 29, 45 },
{ 18587, 30, 29, 29, 167 },
{ 19022, 30, 28, 51, 23 },
{ 19442, 30, 28, 51, 189 },
{ 19862, 28, 28, 73, 1 },
{ 20254, 28, 28, 73, 211 },
{ 20646, 400, 149, 190, 47 },
{ 50446, 194, 120, 597, 47 },
{ 62086, 602, 29, 190, 183 }
};
static int32_t scaling;
static int16_t YOFFSET;
#define FX16(x) ((int32_t)((x) * 65536.0f))
static int32_t tween(int32_t t, int32_t a, int32_t b)
{
uint16_t tu, tu2, tu3;
if (t < 0)
return a;
if (t > 65535)
return b;
tu = t;
tu = ~tu;
tu2 = ((uint32_t)tu * tu) >> 16;
tu3 = ((uint32_t)tu2 * tu) >> 16;
tu3 = ~tu3;
return a + (((int32_t)tu3 * (b - a)) >> 16);
}
int32_t dc(int16_t c)
{
return (scaling * c) >> 12;
}
static void setup_element(Gpu_Hal_Context_t *phost, const struct element *e)
{
App_WrCoCmd_Buffer(phost, BITMAP_SOURCE(e->src));
App_WrCoCmd_Buffer(phost, BITMAP_LAYOUT(L4, e->w / 2, e->h));
App_WrCoCmd_Buffer(phost, BITMAP_SIZE(BILINEAR,BORDER,BORDER,(dc(e->w) >> 4) + 1,(dc(e->h) >> 4) + 1));
#ifdef FT81X_ENABLE
App_WrCoCmd_Buffer(phost, BITMAP_LAYOUT_H((e->w / 2)>>10, 0));
App_WrCoCmd_Buffer(phost, BITMAP_SIZE_H(((dc(e->w) >> 4) + 1)>>9, ((dc(e->h) >> 4) + 1)>>9));
#endif
}
static void draw(Gpu_Hal_Context_t *phost, const struct element *e, int32_t x)
{
setup_element(phost, e);
App_WrCoCmd_Buffer(phost, VERTEX2F(dc(e->x0) + x, YOFFSET + dc(e->y0)));
}
void App_Show_Logo(Gpu_Hal_Context_t *phost)
{
uint16_t ff,frame,i;
int32_t syo ;
scaling = FX16(1) * DispWidth / 800;
YOFFSET = ((DispHeight << 4) - dc(242)) / 2;
syo = YOFFSET * (FX16(800 / 16) / DispWidth);
Gpu_Hal_WrCmd32(phost,CMD_INFLATE);
Gpu_Hal_WrCmd32(phost,0);
Gpu_Hal_WrCmdBufFromFlash(phost, (uint8_t*)logo_graphics, sizeof(logo_graphics));
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);
for (frame = 0, ff = 0; frame < 120; frame++, ff += 550) {
Gpu_CoCmd_Dlstart(phost);
App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(255,255,255));
App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(LOGO_ICON_HANDLE));
App_WrCoCmd_Buffer(phost, BEGIN(BITMAPS));
Gpu_CoCmd_LoadIdentity(phost);
Gpu_CoCmd_Scale(phost, scaling, scaling);
Gpu_CoCmd_SetMatrix(phost);
App_WrCoCmd_Buffer(phost, COLOR_RGB( 35, 31, 32)); // gray
for (i = 0; i < 10; i++) {
if (i == 9)
App_WrCoCmd_Buffer(phost, COLOR_RGB(237, 28, 36)); // red
draw(phost, &el[i], tween((ff - FX16(.1)) * 3 - FX16(.1) * i, dc(-130), 0));
}
App_WrCoCmd_Buffer(phost, COLOR_RGB( 56, 113, 193)); // blue
App_WrCoCmd_Buffer(phost, SAVE_CONTEXT());
setup_element(phost, &el[10]);
App_WrCoCmd_Buffer(phost, BITMAP_SIZE(BILINEAR, BORDER, BORDER, 0, 0));
Gpu_CoCmd_LoadIdentity(phost);
Gpu_CoCmd_Scale(phost, scaling, scaling);
Gpu_CoCmd_Translate(phost, (int32_t)el[10].x0 << 16, ((int32_t)el[10].y0 << 16) + syo + FX16(60));
Gpu_CoCmd_Rotate(phost, -tween((ff - FX16(.1)) * 2, 0x4000, 0x0000));
Gpu_CoCmd_Translate(phost, FX16(0), FX16(-60));
Gpu_CoCmd_SetMatrix(phost);
App_WrCoCmd_Buffer(phost, VERTEX2F(0, 0));
App_WrCoCmd_Buffer(phost, RESTORE_CONTEXT());
draw(phost, &el[11], tween((ff - FX16(.4)) * 3, dc(210), 0));
App_WrCoCmd_Buffer(phost, COLOR_RGB( 35, 31, 32)); // gray
App_WrCoCmd_Buffer(phost, COLOR_A(tween((ff - FX16(.75)) * 4, 0, 255)));
draw(phost, &el[12], 0);
App_WrCoCmd_Buffer(phost, DISPLAY());
Gpu_CoCmd_Swap(phost);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);
}
/* Show dummy clear screen to clean up logo after animation */
Gpu_CoCmd_Dlstart(phost);
Gpu_ClearScreen(phost);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);
Gpu_Hal_Sleep(20);
}
/******************************************************************************/
void App_Common_Init(Gpu_Hal_Context_t *phost) {
Gpu_HalInit_t halinit;
uint8_t chipid;
Gpu_Hal_Init(&halinit);
Gpu_Hal_Open(phost);
Gpu_Hal_Powercycle(phost, TRUE);
/* FT81x will be in SPI Single channel after POR
If we are here with FT4222 in multi channel, then
an explicit switch to single channel is essential
*/
#if (defined(FT81X_ENABLE)) || (defined(BT81X_ENABLE))
Gpu_Hal_SetSPI(phost, GPU_SPI_SINGLE_CHANNEL, GPU_SPI_ONEDUMMY);
#endif
// Gpu_HostCommand(phost,0x68);
// Gpu_Hal_Sleep(300);
/* access address 0 to wake up the chip */
//Gpu_HostCommand(phost, GPU_SLEEP_M);
//Gpu_Hal_Sleep(300);
#if (defined(EVE_2) && (defined(NTP_50)||defined(RTP_50)||defined(CTP_50)||defined(NTP_70)||defined(RTP_70)||defined(CTP_70)))
Gpu_HostCommand(phost,GPU_INTERNAL_OSC);
#else
#if (defined(EVE_4_INTERNAL_OSC))
Gpu_HostCommand(phost, GPU_INTERNAL_OSC);
#else
Gpu_HostCommand(phost,GPU_EXTERNAL_OSC);
#endif
#endif
Gpu_Hal_Sleep(100);
Gpu_HostCommand(phost, GPU_ACTIVE_M);
Gpu_Hal_Sleep(300);
//Gpu_HostCommand(phost,GPU_EXTERNAL_OSC);
//Gpu_HostCommand(phost,GPU_PLL_48M);
//Gpu_81X_SelectSysCLK(phost, GPU_SYSCLK_72M);
Gpu_Hal_Wr32(phost, REG_FREQUENCY, 72000000);
uint32_t freq = Gpu_Hal_Rd32(phost, REG_FREQUENCY);
Gpu_Hal_Wr8(phost, REG_TRIM, 25);
/* read Register ID to check if chip ID series is correct */
chipid = Gpu_Hal_Rd8(phost, REG_ID);
while (chipid != 0x7C) {
chipid = Gpu_Hal_Rd8(phost, REG_ID);
Gpu_Hal_Sleep(100);
}
/* read REG_CPURESET to confirm 0 is returned */
{
uint8_t engine_status;
/* Read REG_CPURESET to check if engines are ready.
Bit 0 for coprocessor engine,
Bit 1 for touch engine,
Bit 2 for audio engine.
*/
engine_status = Gpu_Hal_Rd8(phost, REG_CPURESET);
while (engine_status != 0x00) {
engine_status = Gpu_Hal_Rd8(phost, REG_CPURESET);
Gpu_Hal_Sleep(100);
}
}
Gpu_Hal_Wr16(phost, REG_PWM_HZ, 4000);
Gpu_Hal_Wr8(phost, REG_PWM_DUTY, 128);
uint16_t pwmHz = Gpu_Hal_Rd16(phost, REG_PWM_HZ);
#if defined (EVE_4)
Gpu_Hal_Wr16(phost, REG_PCLK_FREQ, DispPLCLKFREQ);
Gpu_Hal_Wr8(phost, REG_PCLK_2X, DispPCLK2x);
#endif
/* configuration of LCD display */
Gpu_Hal_Wr16(phost, REG_HCYCLE, DispHCycle);
Gpu_Hal_Wr16(phost, REG_HOFFSET, DispHOffset);
Gpu_Hal_Wr16(phost, REG_HSYNC0, DispHSync0);
Gpu_Hal_Wr16(phost, REG_HSYNC1, DispHSync1);
Gpu_Hal_Wr16(phost, REG_VCYCLE, DispVCycle);
Gpu_Hal_Wr16(phost, REG_VOFFSET, DispVOffset);
Gpu_Hal_Wr16(phost, REG_VSYNC0, DispVSync0);
Gpu_Hal_Wr16(phost, REG_VSYNC1, DispVSync1);
Gpu_Hal_Wr8(phost, REG_SWIZZLE, DispSwizzle);
Gpu_Hal_Wr8(phost, REG_PCLK_POL, DispPCLKPol);
Gpu_Hal_Wr16(phost, REG_HSIZE, DispWidth);
Gpu_Hal_Wr16(phost, REG_VSIZE, DispHeight);
Gpu_Hal_Wr16(phost, REG_CSPREAD, DispCSpread);
Gpu_Hal_Wr16(phost, REG_DITHER, DispDither);
/* GPIO configuration */
#if (defined(FT81X_ENABLE)) || (defined(BT81X_ENABLE))
Gpu_Hal_Wr16(phost, REG_GPIOX_DIR, 0xFFFF);
Gpu_Hal_Wr16(phost, REG_GPIOX, 0xFFFF);
#else
Gpu_Hal_Wr8(phost, REG_GPIO_DIR, 0xFF);
Gpu_Hal_Wr8(phost, REG_GPIO, 0xFF);
#endif
Gpu_ClearScreen(phost);
/* after this display is visible on the LCD */
Gpu_Hal_Wr8(phost, REG_PCLK, DispPCLK);
phost->cmd_fifo_wp = Gpu_Hal_Rd16(phost, REG_CMD_WRITE);
}
void App_Common_Close(Gpu_Hal_Context_t *phost) {
Gpu_Hal_Close(phost);
Gpu_Hal_DeInit();
}