annotate src/cs/drivers/drv_app/r2d/lcds/luna/r2d_task_init_i.c @ 650:7d6878435c85

R2D: Luna LCD driver implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 May 2020 07:32:27 +0000
parents
children 094152d97ce7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
650
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "r2d/lcds/luna/r2d_luna_lcd.h"
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #define R2D_MB_PRIM_SIZE (4000)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 static void r2d_refresh_task_init(void)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 UINT32 i;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 /* reset pulse */
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 CNTL_RST_REG |= EXT_RESET;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 rvf_delay(RVF_MS_TO_TICKS(10));
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 CNTL_RST_REG &= ~EXT_RESET;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 rvf_delay(RVF_MS_TO_TICKS(50));
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 /* start register init */
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 LCD_REG_WR(0x0001, 0x011c); // set SS and NL bit
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 LCD_REG_WR(0x0002, 0x0100); // set 1 line inversion
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 LCD_REG_WR(0x0003, 0x1030); // set GRAM write direction and BGR=1.
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 LCD_REG_WR(0x0008, 0x0808); // set BP and FP
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 LCD_REG_WR(0x000F, 0x0901); // Set frame rate
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 rvf_delay(RVF_MS_TO_TICKS(10));
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 LCD_REG_WR(0x0010, 0x0000); // Set SAP,DSTB,STB
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 LCD_REG_WR(0x0011, 0x1B41); // Set APON,PON,AON,VCI1EN,VC
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 rvf_delay(RVF_MS_TO_TICKS(50));
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 LCD_REG_WR(0x0012, 0x200E); // Internal reference voltage= Vci;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 LCD_REG_WR(0x0013, 0x0052); // Set GVDD
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 LCD_REG_WR(0x0014, 0x4B5C); // Set VCOMH/VCOML voltage
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 //------------- Set GRAM area ------------------//
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 LCD_REG_WR(0x0030, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 LCD_REG_WR(0x0031, 0x00DB);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 LCD_REG_WR(0x0032, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 LCD_REG_WR(0x0033, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 LCD_REG_WR(0x0034, 0x00DB);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 LCD_REG_WR(0x0035, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 LCD_REG_WR(0x0036, 0x00AF);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 LCD_REG_WR(0x0037, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 LCD_REG_WR(0x0038, 0x00DB);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 LCD_REG_WR(0x0039, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 // ----------- Adjust the Gamma Curve ----------//
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 LCD_REG_WR(0x0050, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 LCD_REG_WR(0x0051, 0x0705);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 LCD_REG_WR(0x0052, 0x0C0A);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 LCD_REG_WR(0x0053, 0x0401);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 LCD_REG_WR(0x0054, 0x040C);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 LCD_REG_WR(0x0055, 0x0608);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 LCD_REG_WR(0x0056, 0x0000);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 LCD_REG_WR(0x0057, 0x0104);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 LCD_REG_WR(0x0058, 0x0E06);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 LCD_REG_WR(0x0059, 0x060E);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 rvf_delay(RVF_MS_TO_TICKS(50));
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 LCD_REG_WR(0x0007, 0x1017);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 /* initial hw framebuffer clearing */
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 LCD_REG_WR(0x20, 0);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 LCD_REG_WR(0x21, 0);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 LCD_IR = 0x22;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 for (i = 0; i < 176*220; i++)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 LCD_DR = 0xFFFF; /* white color */
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 }
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 static void r2d_refresh_task_kill(void)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 {
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 }
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 static void r2d_dithering_init(void)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 {
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 R2D_MALLOC(r2d_mb_id,UINT32,sizeof(UINT32)*4,r2d_g_dithering_matrix);
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 if (r2d_g_dithering_matrix!=NULL)
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 {
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 r2d_g_dithering_matrix[0]=0;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 r2d_g_dithering_matrix[1]=2;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 r2d_g_dithering_matrix[2]=3;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 r2d_g_dithering_matrix[3]=1;
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }
7d6878435c85 R2D: Luna LCD driver implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 }